Hello, I have a problem which I am not sure the best way to solve with Kamailio. I have many asterisk servers which use Kamailio as their outbound gateway to route calls to the PSTN. This works great, I use the LCR engine to control routing.
What I want to do is have the ability to dial a random SIP URI from my asterisk servers, but route the call through my Kamailio server for accounting and security purposes. My asterisk servers are not allowed SIP messaging from anything other than my Kamailio gateway. What I am considering doing is something like this:
Since asterisk is fairly limited in your ability to route calls, I need to do a little magic to make the call route through a proxy. Maybe I'm wrong, but I haven't yet been able to figure it out. My theory is that I will add a special header at the asterisk level and send the invite to Kamailio.
[test] exten => 1,1,SipAddHeader("P-Forward-URI: bob@somedomain.com") exten => 1,n,Dial(SIP/forward@kamailio,30)
[From Asterisk To Kamailio] INVITE sip:forward@10.1.1.1 SIP/2.0 Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds Max-Forwards: 70 To: sip:forward@10.1.1.1 From: "" sip:5555551212@pc33.atlanta.com;tag=1928301774 Call-ID: a84b4c76e66710@pc33.atlanta.com CSeq: 314159 INVITE Contact: sip:5555551212@pc33.atlanta.com Content-Type: application/sdp Content-Length: 142 P-Forward-URL: bob@somedomain.com
if(is_present_hf("P-Forward-URL")){ //what do i do here to rewrite the To and INVITE parts before doing record_route() and t_relay() }
Maybe I'm totally off track here, but this is all I have come up with so far! Perhaps there is a mechanism in SIP which already allows me to do this, and I don't know about it... I don't know what I don't know :)
Thanks, Geoff