[OpenSIPS-Users] Asterisk Integration - Manipulate Asterisk Contexts

osiris123d duane.larson at gmail.com
Sat Nov 6 01:41:10 CET 2010


I have set up Asterisk to work with OpenSIPS so that instead of the context
for all OpenSIPS Subscribers being "default" it is their actual domain. 
Following the OpenSIPS Tutorial to integrate with Asterisk worked well with
this until it came time for a XYZ at DomainA to call a ABC at DomainB. 
XYZ at DomainA gets sent to ABC at DomainB's voicemail if they don't pick up. 
Well with multiple contexts set up with Asterisk XYZ at DomainA is going to be
funnelled into Asterisk context DomainA since he is apart of Context
DomainA.  This isn't good since context DomainA doesn't have a user called
ABC

I found a way around this

With OpenSIPS I do the following
if($rd != $var(callee_domain)){
	prefix("VMS_"); 
	append_hf("P-Asserted-Identity: $var(callee_domain)\r\n"); 
} 
else{
        prefix("VMR_");
} 
rewritehostport("ASTERISK_IP");


And in Asterisk I did this

; Leave Voicemail for DomainA.com employee from External DID
exten => _VMR_.,1,Ringing
exten => _VMR_.,n,Wait(1)
exten => _VMR_.,n,Answer
exten => _VMR_.,n,Wait(1)
exten => _VMR_.,n,Voicemail(${EXTEN:4}@coolbeans.com,u)
exten => _VMR_.,n,Hangup

; Leave Voicemail for other customer when DomainA.com employee calls them
exten => _VMS_.,1,Ringing 
exten => _VMS_.,n,Wait(1) 
exten => _VMS_.,n,Answer 
exten => _VMS_.,n,Wait(1) 
exten => _VMS_.,n,NoOp(${SIP_HEADER(P-Asserted-Identity)})
exten => _VMS_.,n,Voicemail(${EXTEN:4}@${SIP_HEADER(P-Asserted-Identity)},u)
exten => _VMS_.,n,Hangup 






This works!!!!!!  But what I want to know is am I breaking some rules here
by appending a P-Asserted-Identity SIP header and then looking for it in
Asterisk????  

Comments???
-- 
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Asterisk-Integration-Manipulate-Asterisk-Contexts-tp5711054p5711054.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list