Hello,
I have some lines configured to hang up without answering the call, when there are some conditions. The Answer() is not negotiable; I cannot do it because my client would be billed an international phone call, so the line needs to be disconnected before answering
[context]
exten = _X.,1,Noop()
<Code that checks if we can pick up the call>
same = n,Hangup()
Now, I have found that different SIP trunk providers react differently. I actually have three providers. One of them reacts properly to the Hangup() and just closes the connection, so the client who is calling gets disconnected. This is the expected behavior for me. The problem is that this provider is much more expensive than the others (otherwise, I’d use this one for all lines)
Another one disconnects the client but appends a locution saying that “the line is not available”, which is not ideal because it confuses the client. The client should just hear a “busy line” tone. However, at least it disconnects the user after the locution.
Finally, a third one, and this is where it gets weird, sends my server subsequent “100” just after I hang up, so in the same phone call, the client gets connected and disconnected about 3-4 times, (I have tried this myself, the context gets called 3-4 times) until the client’s provider times out (about 30 secs). This is again not ideal because then the client needs to wait for 30 seconds to get disconnected, while they should be disconnected immediately.
I have tried the following with no luck
- Playing with Progress()
- Adding different Hangup() causes (1, 16, 17, 21, 27, 38…)
- Playing with prematuremedia and progressinband
I’ve read a lot of posts on the topic. Some say that in SIP, you can’t hangup() before answer(), so the behavior is unpredictable. Some say that this may be a proxy retrying the call.
Could I at least have some way to disconnect the caller or ignore subsequent “100” after I hangup()? Again, my goal is to Hangup() before Answer() and have the caller get disconnected immediately.
Here’s my sip.conf. It is identical for the different providers, changing only the IP addresses.
[provider]
type=friend
context=context
Host=<ip>
Canreinvite=no
nat=yes
fromdomain=<domain>
Disallow=all
Allow=alaw
Insecure=port,invite
deny=0.0.0.0/0.0.0.0
permit=<ip>/255.255.255.255
prematuremedia=no
progressinband=yes
Thanks a lot. I’ve been fighting for this for months now.