In sip.conf, my SIP peers use a context ‘from-internal-phone’ for dialing calls. I also have them set some channel variables using ‘setvar=’. This works properly for outbound calls where my users pick up their phones and dial a phone number (or extension).
[phone1] type=friend secret=1234 qualify=yes nat=yes host=dynamic context=from-internal-phone setvar=phone=phone1 setvar=user=user1 canreinvite=no
The problem occurs when one of my phones has Call Forwarding turned on. When someone calls, the phones sends a “302 Moved Temporarily” to Asterisk. As expected, Asterisk then initiates a call from that peer using the correct ‘from-internal-phone’ context. Unfortunately, the channel variables are not set.
-- Got SIP response 302 "Moved Temporarily" back from 220.127.116.11 -- Now forwarding SIP/18.104.22.168-0000019b to 'Local/19525551234@from-internal-phone' (thanks to SIP/phone1-0000019c) -- Executing [19525551234@from-internal-phone:1] NoOp("Local/19525551234@from-internal-phone-1121;2", "phone=") in new stack
Can anyone help?