[Asterisk-Users] SIP header values in the dialplan

Jesper Dalberg dalberg at cybercity.dk
Thu Oct 7 03:16:01 MST 2004


I was wondering how to get access to the headers of the INVITE on
incomming SIP calls in the Dialplan.

My scenario is that i use "register" in sip.conf to register a UA on
which to accept incomming calls. In sip.conf, calls to that UA is
redirected to a specific extension in extensions.conf (btw: can that be
a dynamic value, for example ${CALLERID} or
${WHEREEVERMYCALLEDNUMBERISORISNOT}, to get the voicemail prompts to
read the correct extension number?). The extension just has to do some
logic on both the callerID and the called number, which is in the To:
header in the INVITE, NOT the extension in the INVITE itself. The reason
I need the To: header, is that my "real" extensions are on another SIP
server, so the way they activate their voicemail is to forward to my
asterisk SIP UA.

I need to be able to do logic like

if ( MailboxExists( ${CALLERID} ) ) {
	; the mailbox owner dialed in directly
	VoiceMailMain( ${CALLERID} )
}
elsif ( MailboxExists( ${B-number from the To: header in the SIP INVITE}
) ) {
	; someone dialed a number that I have a mailbox for 
	; how do I fake the extension number, so that the default
voicemail prompt
	; will read the correct number?
	VoiceMail( ${B-number from the To: header in the SIP INVITE} )
}
else {
	; huh, dunno which mailbox to go to - perhaps make the caller ID
himself
	; an let him into his voicemailbox from an unknown number.
}

... but it seems that I might not have alle the variables I need.

I am pretty new to asterisk, so it could be that I just don't know
enough yet.

Please help if you can ;)

Regards,
Jesper Dalberg



More information about the asterisk-users mailing list