Context For 302 Moved Response

Home » Asterisk Users » Context For 302 Moved Response
Asterisk Users 4 Comments

Hello,

Does anyone know of a way to have a call go to a particular context when a
302 Moved is received in response to an invite? This is with chan_sip. We tried setting __TRANSFER_CONTEXT but it didn’t seem to have any effect. Basically if a remote device returns a 302 Moved we want to send the call somewhere different to all other calls.

Thanks very much,

4 thoughts on - Context For 302 Moved Response

  • El Wed, 27 Apr 2022 12:27:03 +1200
    David Cunningham escribió:

    You can detect a 302 in the dialplan. Not perfect but does the job.

    same => n,GotoIf($[${EXISTS(${FORWARDERNAME})}]?sipcfu)


    PekePBX, the multitenant PBX solution https://pekepbx.com

  • Hi Jon,

    Thank you for the reply. We wanted to read a particular SIP header in the
    302 Moved response, but it seems that Asterisk creates a Local channel for the redirected call and the SIP_HEADER() function isn’t available, so we can’t really do what we wanted at all.

    Thanks anyway!

  • Neither chan_sip or chan_pjsip provide such ability even if you had access to the SIP or PJSIP channel. SIP_HEADER() gets headers from an incoming INVITE, same for PJSIP_HEADER().

  • Hi Joshua,

    Thanks for the reply. In this case we get a special SIP header in the 302, but I guess we’ll need to find another solution to use it.