Between A Dumb Client And A Capable Server…

Home » Asterisk Users » Between A Dumb Client And A Capable Server…
Asterisk Users 12 Comments

Hi.

I wonder if anyone has some helpful advice or suggestions for me?

I have a very basic SIP client application, which can make and receive phone calls, and that’s about it. Regard it as a pretty dumb softphone.
Unfortunately I cannot change it for a smarter one.

This client is talking to a completely capable SIP server (PBX) which can do all the standard PBX stuff like putting calls on hold, transferring them, conferencing, etc.

The problem is that the simple SIP client cannot itself tell the server to do any of these things – it can send an INVITE to place a call, and it can REGISTER and then accept an INVITE to receive a call, but it doesn’t know how to send any other commands to the server to “manage” calls once they’re in progress.

I’m looking for something which I can place in the network path between the client and the server, which can send these call control commands on to the server, so that it can then put calls on hold, transfer them, etc.

I’m assuming this “thing” needs to sit in the network path, so that it sees the INVITEs and OKs and is then aware of the Call-IDs and sequence numbers, etc, and can therefore present the correct call reference to the SIP server when it wants to say “please put this one on hold”. I have full access to the SIP credentials used to authenticate the client to the server.

I had thought that Kamailio might be what I was looking for, but I’ve asked on their mailing list and people are telling me that it isn’t, and that I need something like Asterisk to do this. I’m trying to get some specifics from them about *how* I would get Asterisk to do this (because I personally can’t see how Asterisk could sit between a SIP client and a SIP server, and generate commands to manipulate the RTP stream and send them to the server, which is what the Kamailio people are saying I should do), but I thought it was worth asking here just in case what they’re telling me is in fact quite easy when you only know enough about Asterisk.

So, if someone here thinks this is possible using Asterisk, please could you point me at some documentation showing what commands I would use or the basics of how I should go about it?

If anyone thinks there is another, perhaps better, way of achieving this, then I’m quite open to alternative solutions (as I say, I was initially thinking that Kamailio might be the way forward), so anything that shows me *how* such a thing might be achieved, with any tool at all, would be very welcome.

Just to summarise: I have a SIP client talking to a SIP server, and I need something which can send commands to that server to put calls, which were created by the existing client, on hold (that’s the simplest scenario). I do not want to build a SIP server / PBX myself which can itself perform call hold
& transfer etc (I know how to do that with Asterisk) – I need those functions to be performed by the existing server.

Any constructive ideas are most welcome 🙂

Thanks,

Antony.


Numerous psychological studies over the years have demonstrated that the majority of people genuinely believe they are not like the majority of people.

Please reply to the list;
please *don’t* CC me.

12 thoughts on - Between A Dumb Client And A Capable Server…

  • I think I would start by finding an open source SIP client that can manage calls like you want, then figure out how to divide the control and audio responsibilities between these two SIP clients. Curious about why you can’t just use the more capable SIP client.

    –Don

    —–Original Message—–
    From: asterisk-users On Behalf Of Antony Stone Sent: Wednesday, August 18, 2021 4:33 AM
    To: Asterisk Users’ Mailing List – Non-Commercial Discussion
    Subject: [asterisk-users] Between a dumb client and a capable server…

    Hi.

    I wonder if anyone has some helpful advice or suggestions for me?

    I have a very basic SIP client application, which can make and receive phone calls, and that’s about it. Regard it as a pretty dumb softphone.
    Unfortunately I cannot change it for a smarter one.

    This client is talking to a completely capable SIP server (PBX) which can do all the standard PBX stuff like putting calls on hold, transferring them, conferencing, etc.

    The problem is that the simple SIP client cannot itself tell the server to do any of these things – it can send an INVITE to place a call, and it can REGISTER and then accept an INVITE to receive a call, but it doesn’t know how to send any other commands to the server to “manage” calls once they’re in progress.

    I’m looking for something which I can place in the network path between the client and the server, which can send these call control commands on to the server, so that it can then put calls on hold, transfer them, etc.

    I’m assuming this “thing” needs to sit in the network path, so that it sees the INVITEs and OKs and is then aware of the Call-IDs and sequence numbers, etc, and can therefore present the correct call reference to the SIP server when it wants to say “please put this one on hold”. I have full access to the SIP credentials used to authenticate the client to the server.

    I had thought that Kamailio might be what I was looking for, but I’ve asked on their mailing list and people are telling me that it isn’t, and that I need something like Asterisk to do this. I’m trying to get some specifics from them about *how* I would get Asterisk to do this (because I personally can’t see how Asterisk could sit between a SIP client and a SIP server, and generate commands to manipulate the RTP stream and send them to the server, which is what the Kamailio people are saying I should do), but I thought it was worth asking here just in case what they’re telling me is in fact quite easy when you only know enough about Asterisk.

    So, if someone here thinks this is possible using Asterisk, please could you point me at some documentation showing what commands I would use or the basics of how I should go about it?

    If anyone thinks there is another, perhaps better, way of achieving this, then I’m quite open to alternative solutions (as I say, I was initially thinking that Kamailio might be the way forward), so anything that shows me *how* such a thing might be achieved, with any tool at all, would be very welcome.

    Just to summarise: I have a SIP client talking to a SIP server, and I need something which can send commands to that server to put calls, which were created by the existing client, on hold (that’s the simplest scenario). I do not want to build a SIP server / PBX myself which can itself perform call hold
    & transfer etc (I know how to do that with Asterisk) – I need those functions to be performed by the existing server.

    Any constructive ideas are most welcome 🙂

    Thanks,

    Antony.


    Numerous psychological studies over the years have demonstrated that the majority of people genuinely believe they are not like the majority of people.

    Please reply to the list;
    please *don’t* CC me.

  • I can certainly find those.

    Do you believe it is possible for one SIP client to place a call, and for another one then to contact the server which is handling it and send commands to manage that call in progress?

    I’m puzzled about how the authentication would work for identifying the call to the server in such a way that it thinks the request is valid, and acts upon it.

    I can put the same SIP credentials (username & password) into two clients, but they’d be placing quite independent calls through the server – how could I get a second client to manipulate a call placed by the first one?

    It’s built into a bigger application and can’t just be swapped out.

    Antony.


    90% of networking problems are routing problems.
    9 of the remaining 10% are routing problems in the other direction. The remaining 1% might be something else, but check the routing anyway.

    Please reply to the list;
    please *don’t* CC me.

  • Sorry about the top-posting…but that’s what my app does!

    I think it’s doable, but would take me six months to work it out! Let’s see who jumps in.

    –Don

    —–Original Message—–
    From: asterisk-users I can certainly find those.

    Do you believe it is possible for one SIP client to place a call, and for another one then to contact the server which is handling it and send commands to manage that call in progress?

    I’m puzzled about how the authentication would work for identifying the call to the server in such a way that it thinks the request is valid, and acts upon it.

    I can put the same SIP credentials (username & password) into two clients, but they’d be placing quite independent calls through the server – how could I get a second client to manipulate a call placed by the first one?

    It’s built into a bigger application and can’t just be swapped out.

    Antony.


    90% of networking problems are routing problems.
    9 of the remaining 10% are routing problems in the other direction. The remaining 1% might be something else, but check the routing anyway.

    Please reply to the list;
    please *don’t* CC me.

  • snip

    I had thought that Kamailio might be what I was looking for, but I’ve asked Sounds like you’re looking for something to do 3rd Party Call Control
    (3PCC). It also sounds like the ‘SIP server” isn’t Asterisk and you can’t change that either right?

    You could actually use a tiny Asterisk instance to do this. The dumb client would call Asterisk and Asterisk would simply send the call to your existing SIP
    server. You could then use AMI or ARI to watch for the call events and tell Asterisk to transfer to some other extension on your SIP server or whatever. The big question is… what triggers the action to take?

  • Okay, that sounds like useful terminology.

    It *might* be Asterisk, but if it is, I have no access to it other than the SIP credentials a standard telephone would use to register to it. Then again, I might not even *know* what it is – it’s just a SIP-based PBX…

    Hm, I’m very dubious about that, based on what I’ve seen in docs so far…

    Okay, so far, so good, I can get Asterisk to do that.

    So, let’s just take the simplest example – how can I get Asterisk to tell the other server to put a call on hold and play that other server’s hold music to the remote party?

    That’s easy, I have a web interface which is on the same machine as the dumb SIP softphone, and that can talk to this “tiny Asterisk server” you speculate about, for example by sending in AMI Originate commands to it, which can trigger dial plan actions, which can do anything Asterisk is capable of.

    My doubts are whether Asterisk as a SIP *client* is capable of this.

    So, if I have Asterisk registered as a SIP client to some remote server, how can I get Asterisk to tell that remote server to put the call on hold (which a standard SIP telephone would normally do by sending a ReINVITE with the SDP
    parameter ‘sendonly’)?

    Thanks,

    Antony.


    “The future is already here. It’s just not evenly distributed yet.”

    – William Gibson

    Please reply to the list;
    please *don’t* CC me.

  • On the outgoing pjsip endpoint, set “moh_passthrough = yes”. If you then put incoming call on hold, a reinvite with sendonly will be sent to the upstream server.

  • So… how do I put the incoming call on hold, when the dumb client I’m starting from cannot do that bit?

    I already know (from this list) that Asterisk as a SIP client cannot do ore than (a) place a call, (b) answer a call, and (c) hang up a call.

    So, I’m still intrigued as to how you think this might be possible.

    If it *is* possible, I’d be really interested, but all my researches so far suggest that Asterisk, acting in the middle like this, just cannot add the necessary “put call on hold” which the original client cannot do.

    Antony.


    Some things the German language doesn’t easily distinguish between:
    – slugs and snails
    – cucumbers and gherkins
    – snakes and queues
    – wearing something, or carrying it
    – mothers and nuts
    – driving a car, riding a bicycle, or travelling by train
    – a man and a husband
    – a woman and a wife
    – changing clothes and moving house
    – pockets and bags

    Please reply to the list;
    please *don’t* CC me.

  • With Asterisk, keep Asterisk in the media path with direct_media=yes and use DTMF to hold, transfer, and other features using features.conf. Asterisk has to stay in the media path when NAT is involved anyway.

    I doubt anything except Asterisk or other B2BUA software can do what you want.


    http://help.nyigc.net/

  • Yeah? Who told you that? 🙂

    Well, I can’t tell you how you should do it but I can tell you how I might attempt it based on what I know of your situation…

    – Create an ARI application in whatever scripting language you like that
    registers itself to Asterisk as “my3pcc” and also opens an HTTP listener
    for incoming 3PCC commands from your web app.
    – In your dialplan, send all incoming calls to Stasis(my3pcc).
    – The event listener (web socket) in your app tells you of the incoming
    call.
    – You create an outgoing channel to the upstream SIP server and bridge
    the two.
    – Your web app can get the channel id from your ARI app and tell your ARI
    app to do something with it, say place it on hold.
    – Your ARI app calls the /channels/{channelId}/hold REST api.

    It’s actually a bit more complicated than that because you have to deal with directionality. You may have to create an intermediate local channel to make sure the hold is sent in the correct direction. You’d have to experiment a bit.