Transparent hangup codes in FreePBX

FreePBX 16, Asterisk 18.

When a trunk answers with 501, I want client receive exactly 501, not 503.

Transparency only for 501 will be OK. No multiple trunks, no failovers.

I have no clue how to configure this keeping all FreePBX functionality :frowning:

I don’t think 501 is a valid ISDN code, so I assume you are talking about SIP on both sides.

Asterisk doesn’t support this. It is not a SP proxy, and not a SIP only system.; it predates common use of VoIP.

All SIP final response codes are converted to the nearest equivalent ISDN cause code, and the ISDN cause code is converted to a SIP one if the incoming channel is SIP. This is not a 1:1 process. It is possible for the dialplan to read the SIP cause code, using the HANGUPCAUSE function, and to set a different ISDN code from the one that Asterisk would set, but you cannot force Asteirsk to output a SIP cause for which there is no corresponding input ISDN one.

Yes, it’s a SIP trunk of course. Call-center<->(SIP)<->FreePBX<->(SIP)<->Provider

Voip provider detects voice assistant answers and immediately sends us 501 code in that case, and call-center software use this information for statistics.

I know it’s can be solved by simple Kamailio configuration on same machine on non-5060 port for SIP, but it’s kind of overkill and I lose my CDRs and call recordings in FreePBX :frowning:

The important thing to note in all this is that Asterisk (which FreePBX runs on top of) is a Back2Back User Agent. So what you now have is:

Incoming Leg (Call-center) <—> Outgoing Leg (Provider). When Provider sends back 501 to the outgoing leg it is going to process that result and do what should be done according to the configuration. That includes even trying failover to another provider if needed. The Outgoing Leg result will then be sanitized into something more generic for the Incoming Leg so it can handle the response.

There are multiple ways to pass the code back through but it’s going to require you customizing things. There are some threads in here dedicated to how to do some custom dialplan and hooking into FreePBX functionality. You could come up with your own method, etc.

In the end you want to take the SIP Code from Outgoing Leg and pass that back to Incoming Leg instead of basing it off the ISDN code it is converted to.

Here’s a block of custom dilaplan I use to send specific SIP response codes to terminate channels when needed. I don’t know you’re use case here, but it will require a custom destination or a custom trunk that goes to the appropriate code before the channel is answered.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.