Patrick:
Patrick Baker wrote:
Hello all,
I've ran into a dilemma regarding on the call structure is setup for my system right now. As of current everything goes through asterisk ie
sip user -> ser -> asterisk -> sip user
what I want to try and accomplish is sip user -> ser -> sip user.
I believe this would remove unnecessary load on asterisk servers and just connect the call directly.
I'm having a hard time understanding how I will do this thought. as of right now I have a forward statement
if (uri=~"^sip:[0-9]*@.*") { forward( 10.0.18.3, 5060 ); break; };
Assuming the phones register to SER one way would be:
if ( (lookup("location") | lookup("aliases") | (src_ip==<pstn gwy ip address>) ) { xlog("L_INFO", "\n[SER]: Call to local proxy user. \n"); if (!t_relay()) { sl_reply_error(); xlog("L_INFO", "\n[SER]: Call to local proxy user failed. \n"); }; break; };
Say I have multiple companies, how would I setup extensions to call sip devices and if I wanted to dial into a sales queue how would it forward to asterisk. Another thing would be voice mail...how would the extension know to goto voicemail after a certain amount of seconds and play a custom greeting that they assigned for their box.
Forward from SER to Asterisk based on either RURI value on an INVITE or on a failure as is the case with a call to voicemail.
The first situation would require you to define a dialplan such that you can identify which inbound calls to SER need to be forwarded to Asterisk. This is much like what you've already done in the above code.
The second situation can be handled using the failure_route in SER. For example if Asterisk voicemail is handled in failure_route[6], assign users the acl value "asterisk", setup the failure route handling in the start of your code, then define the failure route.
if (is_user_in("Request-URI", "asterisk")) { t_on_failure("6"); setflag(6); log(1, "[SER]: Flag for Asterisk redirect successful. \n"); };
failure_route[6] {
xlog("L_INFO", "\n[SER]: START FAILURE BLOCK #7 Unavailable Asterisk user: Time: [%Tf] Method: <%rm> From uri <%fu> To < %tu> IP source address <%is> R-uri: <%ru> Contact Header: <%ct> \n\n");
if (t_check_status("486")) { prefix("b"); xlog("L_INFO", "\n[SER]: FAILURE BLOCK #7 Phone is busy: Time: [%Tf] Method: <%rm> From uri <%fu> \n\n"); } else if (t_check_status("480")) { prefix("u"); xlog("L_INFO", "\n[SER]: FAILURE BLOCK #7 Phone is unavailable: Time: [%Tf] Method: <%rm> From uri <%fu> \n\n"); } else { prefix("u"); xlog("L_INFO", "\n[SER]: FAILURE BLOCK #7 Phone is unavailable for unknown reason: Time: [%Tf] Method: <%rm> From uri <%fu> \n\n"); }
rewritehostport("<asterisk server hostname>:<port on server where sip is listening>"); append_branch(); t_relay_to_udp("<asterisk server hostname>", "<port on server where sip is listening>"); break; }
You notice the prefix("b") and prefix("u") statements in the above code. This is so that SER can prefix the users extension with the 'u' or'b' character that Asterisk uses to designate a busy greeting or unavailable greeting should be played. You can add additional status checks like a 302 for call forwarding etc.
In Asterisk you need to setup sip.conf which I'm assuming you've already done. In addition you need to define extension rules. For individual mailboxes I use the following. See where the prefixed u & b are used in the pattern matching?
exten => _XXXXX,1,VoiceMail2(${EXTEN}) exten => _uXXXXX,1,VoiceMail2(u${EXTEN:1}) exten => _bXXXXX,1,VoiceMail2(b${EXTEN:1})
The same approach works for IVR. I haven't done the agent stuff so your on your own there. If 7700 is your lead number for the IVR then:
exten => 7700,1,Goto(mymainmenu,s,1) exten => #,2,Hangup ; Hang them up.
[mymainmenu] exten => s,1,Ringing ; 2 seconds of ringback exten => s,2,Answer .... etc.
and how would they be billed... sip to sip would be billed thru ser, all zaptel channels thru asterisk??
Billing seems to be unique to each site and their acconting model. I'll leave that one for you :-)
-Steve
Best regards,
Patrick
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers