Astrisk passing variables

I’m trying to pass variables from a SIP header to a peer in the sip.conf file, but cannot get it right.
The incomming INVITE is not matching a peer in the Asterisk, but rather get’s in as allowguest=yes is set. My outgoing peer authenticates with my provider SIP server. The password can be set to 0, but I need to pass the user from the incomming INVITE to the username field of the peer so it can answer the 407 of the SIP server with the correct reply.
I’m using version 1.4.0.

have you tried the SIPGetHeader application ?

I tried that one, but still couldn’t get it to work in the sip.conf file.
Can you post a working example.
This is my peer:

I catch all incoming INVITE under one context and extensions.conf looks something like this:
exten => _X.,1,Dial(SIP/${EXTEN}@sip-out,60)

you wouldn’t … it’s a dialplan application. what’s the sip header you’re trying to get ?

I need one of the following from the SIP header:

  • username
  • The number of the from field - the user A number.

first off, i just realised SIPGetHeader is deprecated in favour of the SIP_HEADER function, but my example is ages old and look like :exten => 326,1,SIPGetHeader(MYHEADER=User-Agent) exten => 326,n,NoOp(${MYHEADER}) exten => 326,n,SIPGetHeader(MYHEADER=Contact) exten => 326,n,NoOp(${MYHEADER}) exten => 326,n,SIPGetHeader(MYHEADER=From) exten => 326,n,NoOp(${MYHEADER}) exten => 326,n,SIPGetHeader(MYHEADER=To) exten => 326,n,NoOp(${MYHEADER}) exten => 326,n,Hangup()

i’ll leave you to establish what you want (try 'CLI> sip debug ip ')