Well, you decide where to strip, depending on your dial plan.  [0-9]{10} matches exactly 10 digits.

914082743304 is twelve.

       if (uri=~"^sip:1[0-9]{10}@bigu.edu") {

               strip(1);

       };
does not match, neither the 011 if test, so if you add strip(2); it will work (remember the ;)
g-)

ronald@stanford.edu wrote:
Greger,

thanks for the reply.  I have not modified the original gateway/pstn  
configuration as far as digit minipulation goes. How and where would I  
strip the digits in ser.cfg?  I tried entering strip(2) just before  
the if (uri=~"^sip:[0-9]{10}@bigu.edu") statement, but the config  
failed to start. It looked like this

strip(2)
if (uri=~"^sip:[0-9]{10}@bigu.edu")

thanks,


Quoting "Greger V. Teigre" <greger@teigre.com>:

  
if (uri=~"^sip:[0-9]{10}@bigu.edu") {        # Domestic PSTN
probably doesn't match the r-uri you have at that point. Have you
stripped 2 digits by then?
g-)

ronald@stanford.edu wrote:
    
hello all,

I am stuck and need your help for +xlite +ser +asterisk +pstn   
calls.  I dial 914082743304 and get "caller Not Found".   I am able  
 to authenticate and complete sip -> sip calls, but cannot complete  
 PSTN calls  I did monitor asterisk and no reroute was offered.

please help!


permissions.allow:

^sip:91[0-9]{10}@bigu\.edu$
^sip:9011[0-9]*@bigu\.edu$
^sip:9[0-9]{10}@bigu\.edu$


ngrep -vvvv proto udp port 5060 produces the following response:

171.66.176.123:47729 -> 192.168.11.243:5060
 INVITE sip:914082743304@bigu.edu SIP/2.0..Via: SIP/2.0/UDP   
192.168.1.100:47729;br
   
anch=z9hG4bK-d87543-4f5eb56fc40f1f43-1--d87543-;rport..Max-Forwards:   
70..Contact: <si
 p:cell@192.168.1.100:47729>..To:   
"914082743304"<sip:914082743304@bigu.edu>..From:
  "SER EXpress"<sip:cell@bigu.edu>;tag=b9283f27..Call-ID:   
Y2JkY2ZmMDQyMjQ3YTljYTg5
 NTdlOGFiNGUyZWVlY2Q...CSeq: 1 INVITE..Allow: INVITE, ACK, CANCEL,   
OPTIONS, BYE, REFER
 , NOTIFY, MESSAGE, SUBSCRIBE, INFO..Content-Type:   
application/sdp..User-Agent: eyeBea
 m release 1011s stamp 41121..Content-Length: 421....v=0..o=- 1 2   
IN IP4 192.168.1.100
 ..s=CounterPath eyeBeam 1.5..c=IN IP4 192.168.1.100..t=0   
0..m=audio 32942 RTP/AVP 107
  100 106 6 0 105 8 18 3 5 101..a=fmtp:18 annexb=yes..a=fmtp:101   
0-15..a=rtpmap:107 BV
 32/16000..a=rtpmap:100 SPEEX/16000..a=rtpmap:106   
SPEEX-FEC/16000..a=rtpmap:105 SPEEX-
 FEC/8000..a=rtpmap:18 G729/8000..a=rtpmap:101   
telephone-event/8000..a=sendrecv..a=x-r
 tp-session-id:AEB31A44A04C4B32BD3D72349E4FBB80..                    
                  #
U 192.168.11.243:5060 -> 171.66.176.123:47729
 SIP/2.0 404 caller Not Found..Via: SIP/2.0/UDP   
192.168.1.100:47729;branch=z9hG4bK-d875
   
43-4f5eb56fc40f1f43-1--d87543-;rport=47729;received=171.66.176.123..To:   
"914082743304
   
"<sip:914082743304@bigu.edu>;tag=21f9bfca23409407a263e4a7e40abe9d.f2a8..From:   
"SE
 R EXpress"<sip:cell@bigu.edu>;tag=b9283f27..Call-ID:   
Y2JkY2ZmMDQyMjQ3YTljYTg5NTdl
 OGFiNGUyZWVlY2Q...CSeq: 1 INVITE..Server: Sip EXpress router   
(0.9.4 (i386/linux))..Co
 ntent-Length: 0..Warning: 392 192.168.11.243:5060 "Noisy feedback   
tells:  pid=15307 re
 q_src_ip=171.66.176.123 req_src_port=47729   
in_uri=sip:914082743304@bigu.edu out_u
 ri=sip:914082743304@bigu.edu via_cnt==1"....


debug=3

fork=yes

log_stderror=no



listen=1xx.x4.11.xx3                        # INSERT YOUR IP ADDRESS HERE

port=5060

children=4

alias=sip2.bigu.edu



dns=no

rev_dns=no

fifo="/tmp/ser_fifo"

fifo_db_url="mysql://ser:heslo@localhost/ser"



loadmodule "/usr/local/lib/ser/modules/mysql.so"

loadmodule "/usr/local/lib/ser/modules/sl.so"

loadmodule "/usr/local/lib/ser/modules/tm.so"

loadmodule "/usr/local/lib/ser/modules/rr.so"

loadmodule "/usr/local/lib/ser/modules/maxfwd.so"

loadmodule "/usr/local/lib/ser/modules/usrloc.so"

loadmodule "/usr/local/lib/ser/modules/registrar.so"

loadmodule "/usr/local/lib/ser/modules/auth.so"

loadmodule "/usr/local/lib/ser/modules/auth_db.so"

loadmodule "/usr/local/lib/ser/modules/uri.so"

loadmodule "/usr/local/lib/ser/modules/uri_db.so"

loadmodule "/usr/local/lib/ser/modules/domain.so"

loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"

loadmodule "/usr/local/lib/ser/modules/nathelper.so"

loadmodule "/usr/local/lib/ser/modules/textops.so"

loadmodule "/usr/local/lib/ser/modules/avpops.so"

loadmodule "/usr/local/lib/ser/modules/permissions.so"



modparam("auth_db|permissions|uri_db|usrloc", "db_url",   
"mysql://ser:heslo@localhost/ser")

modparam("auth_db", "calculate_ha1", 1)

modparam("auth_db", "password_column", "password")



modparam("nathelper", "rtpproxy_disable", 1)

modparam("nathelper", "natping_interval", 0)



modparam("mediaproxy","natping_interval", 30)

modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")

modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients")

modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")



modparam("usrloc", "db_mode", 2)



modparam("registrar", "nat_flag", 6)



modparam("rr", "enable_full_lr", 1)



modparam("tm", "fr_inv_timer", 27)

modparam("tm", "fr_inv_timer_avp", "inv_timeout")

#added these timers for voicemail forwarding

modparam("tm", "fr_inv_timer", 25)

modparam("tm", "noisy_ctimer", 1)



modparam("permissions", "db_mode", 1)

modparam("permissions", "trusted_table", "trusted")



route {



       # -----------------------------------------------------------------

       # Sanity Check Section

       # -----------------------------------------------------------------

       if (!mf_process_maxfwd_header("10")) {

               sl_send_reply("483", "Too Many Hops");

               break;

       };



       if (msg:len > max_len) {

               sl_send_reply("513", "Message Overflow");

               break;

       };



       # -----------------------------------------------------------------

       # Record Route Section

       # -----------------------------------------------------------------

       if (method=="INVITE" && client_nat_test("3")) {

               # INSERT YOUR IP ADDRESS HERE

               record_route_preset("1xx.x4.11.xx3:5060;nat=yes");

       } else if (method!="REGISTER") {                         
record_route();               };



       # -----------------------------------------------------------------

       # Call Tear Down Section

       # -----------------------------------------------------------------

       if (method=="BYE" || method=="CANCEL") {

               end_media_session();

       };



       # -----------------------------------------------------------------

       # Loose Route Section

       # -----------------------------------------------------------------

       if (loose_route()) {



               if ((method=="INVITE" || method=="REFER") && !has_totag()) {

                       sl_send_reply("403", "Forbidden");

                       break;

               };



               if (method=="INVITE") {



                       if (!allow_trusted()) {

                               if   
(!proxy_authorize("sip2.bigu.edu","subscriber")) {

                                       proxy_challenge("sip2.bigu.edu","0");

                                       break;

                               } else if (!check_from()) {

                                       sl_send_reply("403", "Use From=ID");

                                       break;

                               };

                               consume_credentials();

                       };



                       if   
(client_nat_test("3")||search("^Route:.*;nat=yes")){

                               setflag(6);

                               use_media_proxy();

                       };

               };



               route(1);

               break;

       };



       # -----------------------------------------------------------------

       # Call Type Processing Section

       # -----------------------------------------------------------------

       if (!is_uri_host_local()) {

               if (is_from_local() || allow_trusted()) {

                       route(4);

                       route(1);

               } else {

                       sl_send_reply("403", "Forbidden");

               };

               break;

       };



       if (method=="ACK") {

               route(1);

               break;

       } else if (method=="CANCEL") {

               route(1);

               break;

       } else if (method=="INVITE") {

               route(3);

               break;

       } else         if (method=="REGISTER") {

               route(2);

               break;

       };



       lookup("aliases");

       if (!is_uri_host_local()) {

               route(4);

               route(1);

               break;

       };



       if (!lookup("location")) {

               sl_send_reply("404", "User Not Found");

               break;

       };



       route(1);

}



route[1] {



       # -----------------------------------------------------------------

       # Default Message Handler

       # -----------------------------------------------------------------



       t_on_reply("1");



       if (!t_relay()) {



               if (method=="INVITE" || method=="ACK") {

                       end_media_session();

               };



               sl_reply_error();

       };

}



route[2] {



       # -----------------------------------------------------------------

       # REGISTER Message Handler

       # -----------------------------------------------------------------



       sl_send_reply("100", "Trying");



       if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {

               setflag(6);

               fix_nated_register();

               force_rport();

       };



       if (!www_authorize("sip2.bigu.edu","subscriber")) {

               www_challenge("sip2.bigu.edu","0");

               break;

       };



       if (!check_to()) {

               sl_send_reply("401", "Unauthorized");

               break;

       };



       consume_credentials();



       if (!save("location")) {

               sl_reply_error();

       };

}



route[3] {



       # -----------------------------------------------------------------

       # INVITE Message Handler

       # -----------------------------------------------------------------



       if (client_nat_test("3")) {

               setflag(7);

               force_rport();

               fix_nated_contact();

       };



       if (!allow_trusted()) {



               if (!proxy_authorize("sip2.bigu.edu","subscriber")) {

                       proxy_challenge("sip2.bigu.edu","0");

                       break;

               } else if (!check_from()) {

                       sl_send_reply("403", "Use From=ID");

                       break;

               };



               consume_credentials();

       };



       if (uri=~"^sip:1[0-9]{10}@bigu.edu") {

               strip(1);

       };



       lookup("aliases");

       if (!is_uri_host_local()) {

               route(4);

               route(1);

               break;

       };



       if (uri=~"^sip:011[0-9]*@bigu.edu") {                #   
International PSTN

               route(4);

               route(5);

               break;



       };



       if (!lookup("location")) {

               if (uri=~"^sip:[0-9]{10}@bigu.edu") {        # Domestic PSTN

                       route(4);

                       route(5);

                       break;

               };



               sl_send_reply("404", "caller Not Found");

               break;

       };



       route(4);

       route(1);

}



route[4] {



       # -----------------------------------------------------------------

       # NAT Traversal Section

       # -----------------------------------------------------------------



       if (isflagset(6) || isflagset(7)) {

               if (!isflagset(8)) {

                       setflag(8);

                       use_media_proxy();

               };

       };

}



route[5] {



       # -----------------------------------------------------------------

       # PSTN Handler

       # -----------------------------------------------------------------



       rewritehost("1xx.x4.8.xx8"); # INSERT YOUR PSTN GATEWAY IP ADDRESS



       avp_write("i:45", "inv_timeout");



       route(1);

}



onreply_route[1] {



       if ((isflagset(6) || isflagset(7)) &&

           (status=~"(180)|(183)|2[0-9][0-9]")) {



               if (!search("^Content-Length:[ ]*0")) {

                       use_media_proxy();

               };

       };



       if (client_nat_test("1")) {

               fix_nated_contact();

       };

}

------------------------------------------------------------------------

_______________________________________________
Serusers mailing list
Serusers@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers

      


_______________________________________________
Serusers mailing list
Serusers@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers