VoIP: OpenSIPS route ke arah Asterisk

From OnnoWiki
Revision as of 08:40, 20 January 2014 by Onnowpurbo (talk | contribs) (New page: Sumber: http://www.opensips.org/Documentation/Tutorials-OpenSIPSAsteriskIntegration-1-8 Contoh hook ke Asterisk # ASTERISK HOOK - BEGIN # media service number? (digits starting with *)...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sumber: http://www.opensips.org/Documentation/Tutorials-OpenSIPSAsteriskIntegration-1-8

Contoh hook ke Asterisk

# ASTERISK HOOK - BEGIN # media service number? (digits starting with *) if ($rU=~"^\*[1-9]+") { # we do provide access to media services only to our # subscribers, who were previously authenticated if (!is_from_local()) { send_reply("403","Forbidden access to media service"); exit; } #identify the services and translate to Asterisk extensions if ($rU=="*1111") { # access to own voicemail IVR $ru = "sip:VM_pickup@ASTERISK_IP:ASTERISK_PORT"; } else if ($rU=="*2111") { # access to the "say time" announcement $ru = "sip:AN_time@ASTERISK_IP:ASTERISK_PORT"; } else if ($rU=="*2112") { # access to the "say date" announcement $ru = "sip:AN_date@ASTERISK_IP:ASTERISK_PORT"; } else if ($rU=="*2113") { # access to the "echo" service $ru = "sip:AN_echo@ASTERISK_IP:ASTERISK_PORT"; } else if ($rU=~"\*3[0-9]{3}") { # access to the conference service # remove the "*3" prefix and place the "CR_" prefix strip(2); prefix("CR_"); rewritehostport("ASTERISK_IP:ASTERISK_PORT"); } else { # unknown service $ru = "sip:AN_notavailable@ASTERISK_IP:ASTERISK_PORT"; } # after setting the proper RURI (to point to corresponding ASTERISK extension), # simply forward the call t_relay(); exit; } # ASTERISK HOOK - END


Referensi