Re: [OpenSIPS-Users] need advice on B2b

2010-01-06 Thread ha do
HI Anca

i am trying to use the b2b_request + b2b_reply

route{
...
if(is_method(INVITE)   !(src_ip == 192.168.1.249  src_port ==5060)) 
    {
    if (! t_newtran()){
    sl_reply_error();
    exit;
    };

    b2b_init_request(top hiding);
    exit;
    };

route(1);
}
route[1] {
    if(is_method(INVITE)) {
    route(b2b_request);
    t_on_reply(2);
    }
    else
    if(status==200)
    route(b2b_reply);
    if (!t_relay()) {
    sl_reply_error();
    };
    exit;
}
route[b2b_request] {
  xlog(b2b_request cucku ($ci)\n);
    force_rtp_proxy();
}
route[b2b_reply] {
  xlog(b2b_reply cucku ($ci)\n);
    force_rtp_proxy();
}

i get the errors :  
ERROR:nathelper:force_rtp_proxy: Unable to parse body 
and
 DBG:tm:utimer_routine: timer routine:4,tl=0xb615e9a8 next=(nil), 
timeout=2900
 DBG:tm:timer_routine: timer routine:3,tl=0xb615c6f4 next=(nil), timeout=29
 DBG:tm:delete_handler: removing 0xb615c690
 DBG:tm:delete_cell: delete_cell 0xb615c690: can't delete -- still reffed (1)


===
 DBG:core:get_hdr_field: cseq CSeq: 2 INVITE
 DBG:core:parse_headers: flags=8
 DBG:tm:t_reply_matching: hash 21530 label 76806763 branch 0
 DBG:tm:t_reply_matching: REF_UNSAFE: after is 2
 DBG:tm:t_reply_matching: reply matched (T=0xb615e85c)!
 DBG:tm:t_check: end=0xb615e85c
 DBG:tm:reply_received: org. status uas=0, uac[0]=100 local=2 is_invite=1)
 DBG:tm:t_should_relay_response: T_code=0, new_code=180
 DBG:tm:local_reply: branch=0, save=0, winner=0
 DBG:tm:local_reply: Passing provisional reply 180 to FIFO application
 DBG:tm:run_trans_callbacks: trans=0xb615e85c, callback type 1024, id 0 entered
 DBG:b2b_entities:b2b_parse_key: hash_index = [111]  - local_index= [0]
 DBG:core:parse_headers: flags=
 DBG:core:get_hdr_field: content_length=0
 DBG:core:get_hdr_field: found end of header
 DBG:b2b_entities:b2b_tm_cback: Received a reply with statuscode = 180
 DBG:core:parse_headers: flags=
 DBG:b2b_entities:b2b_new_dlg: 'To' header ALREADY PARSED: 
sip:1...@192.168.1.249
 DBG:b2b_entities:b2b_new_dlg: Not an initial request
 DBG:core:parse_to_param: tag=bfad35cdb22f09f741816636d344f54b-19f0
 DBG:core:parse_to: end of header reached, state=29
 DBG:core:parse_to: display={}, ruri={sip:0873000...@192.168.1.249;user=phone}
 DBG:core:print_rr_body: current rr is sip:192.168.1.249;lr=on
 DBG:core:print_rr_body: out rr [sip:192.168.1.249;lr=on]
 DBG:core:print_rr_body: we have 1 records
 DBG:b2b_entities:b2b_tm_cback: Created new dialog structure 0xb61618c0
 DBG:core:print_rr_body: current rr is sip:192.168.1.249;lr=on
 DBG:core:print_rr_body: out rr [sip:192.168.1.249;lr=on]
 DBG:core:print_rr_body: we have 1 records
 DBG:b2b_logic:b2bl_parse_key: hash_index = [623]  - local_index= [0]
 DBG:core:parse_headers: flags=
 DBG:b2b_entities:b2b_parse_key: hash_index = [346]  - local_index= [0]
 DBG:core:parse_headers: flags=
 DBG:core:check_ip_address: params 192.168.1.4, 192.168.1.4, 0
 DBG:tm:t_reply_with_body: buffer computed
 DBG:tm:_reply_light: reply sent out. buf=0x81c70b8: SIP/2.0 1..., 
shmem=0xb615e534: SIP/2.0 1
 DBG:tm:_reply_light: finished
 b2b_reply cucku (B2B.111.0.1262765386)
 DBG:core:parse_headers: flags=
 DBG:core:parse_headers: flags=1000
 DBG:core:parse_content_type_hdr: missing Content-Type header
 ERROR:nathelper:force_rtp_proxy: Unable to parse body

Thank you
Ha`
--- On Mon, 1/4/10, Anca Vamanu a...@opensips.org wrote:

From: Anca Vamanu a...@opensips.org
Subject: Re: [OpenSIPS-Users] need advice on B2b
To: OpenSIPS users mailling list users@lists.opensips.org
Date: Monday, January 4, 2010, 3:04 AM

Hi Ha`,

There is a very simple example in the documentation:

route[b2b_request] {
  xlog(b2b_request ($ci)\n);
}


route[b2b_reply] {
  xlog(b2b_reply ($ci)\n);
}


You can call in these routes any function that you call in a request route.

Regards,

-- 
Anca Vamanu
www.voice-system.ro



  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Need help on flag in usrloc

2010-01-06 Thread ha do
Hi Bogdan

got it :)

1 more question about the flag 
modparam(nathelper, sipping_bflag, 7)
 modparam(usrloc, nat_bflag, 7)

the modem ADSL will close the port after 3 mins(some minutes), so Opensips 
should send OPTION message(sip ping) to modem to keep port that should open for 
UA 

the sipping_blag of nathelper module should be the same value as nat_bflag of 
usrloc ? or the cflag of usrloc just  has a value??


Thank you
Ha`

--- On Tue, 1/5/10, Bogdan-Andrei Iancu bog...@voice-system.ro wrote:

From: Bogdan-Andrei Iancu bog...@voice-system.ro
Subject: Re: [OpenSIPS-Users] Need help on flag in usrloc
To: OpenSIPS users mailling list users@lists.opensips.org
Date: Tuesday, January 5, 2010, 7:20 AM

Hi Ha,

the NAT branch flag you use is 7 (nat_bflag) and in usrloc you find the 
branch flags in the cflags (contact flags) field. The cflags is a mask 
with all the branch flags: 192 = 128 (2^7) + 64 (2^6)

Regards,
Bogdan


ha do wrote:
 Hi all

 i am successfull to check the UA behind NAT but i dont know what value 
 of the flag will be stored in the usrloc

 Could someone please let me know the value of Nated UA flag, that is 
 stored in usrloc


 my config :
 modparam(nathelper, natping_interval,180)
 modparam(nathelper, ping_nated_only, 1)
 modparam(nathelper, sipping_bflag, 7)
 modparam(nathelper, sipping_from, sip:cu...@kamailio.org)
 modparam(registrar|nathelper, received_avp, $avp(i:80))
 modparam(usrloc, nat_bflag, 7)


 route{

 
 route(4);
 if (method==REGISTER)
         {
                 if (isflagset(5)) {
                         setbflag(6);
                         setbflag(7);
                 }
                 if (!save(location))
                         sl_reply_error();
                 exit;
         }
 }
 route[4]{
         force_rport();
         if (nat_uac_test(19)) {
                 if (method==REGISTER) {
                         fix_nated_register();
                 } else {
                         fix_nated_contact();
                 }
                 setflag(5);
         }
         return;
 }

 mysql select * from location\G
 *** 1. row ***
            id: 12
      username: 1000
        domain: NULL
       contact: sip:1...@192.168.1.2:12280;rinstance=a4752f45bdc3ddd3
      received: sip:210.245.35.150:12280
          path: NULL
       expires: 2010-01-05 17:48:56
             q: -1.00
        callid: YjE1NWJmYWYyYWMzZDg2ZDc5MjY0NDQyMGE5NDEwM2E.
          cseq: 2
 last_modified: 2010-01-05 16:48:56
          flags: 0
         cflags: 192
 user_agent: eyeBeam release 1004p stamp 31962
       socket: udp:118.69.193.198:5060
       methods: 5951


 Thank you
 Ha`



 

 ___
 Users mailing list
 Users@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users
   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



  ___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need advice on B2b

2010-01-06 Thread Anca Vamanu

Hi Ha`,

The excerpt from your script shows that you don't have a good 
understanding of the opensips scripting logic. First, the *route* block 
will only be called for SIP Requests.

Calling this is not right:
 /   if(status==200)
   route(b2b_reply);

/The replies will go into reply route blocks. You can have a default 
reply route ( one without an index or with index 0), or you can specify 
a certain reply route for a request by calling  t_on_reply.


Second, you don't understand what happens with b2b request and replies. 
It is explained in the documentation:


/The requests and replies that are received by the B2BUA server, 
belonging to the dialogs it is handling will not go into the script as 
normal request do. The reason for this is that this are not normal 
requests where the server is a proxy, but the server is an endpoint in 
the dialog and therefore they should not go through the same routes. 
However, it is normal for this request to be seen from the script and 
allow the script writer to do the processing it desires based on them. 
For this, it is possible to define two special B2B routes - one for 
requests and one for replies. The routes are of type *route* and have 
their name defined in the modules parameters *script_req_route* and 
*script_reply_route*. /


In other words, there are two important things:
1. the B2B requests/replies will not go into the default request/reply 
route block.
2. the b2b_request/b2_reply route will be called automatically for every 
request/reply targeted to the b2b agent


So, for your script, you don't need this lines:

  /  if(is_method(INVITE)) {
   route(b2b_request);
   t_on_reply(2);
   }
   else
   if(status==200)
   route(b2b_reply);/

Hope this made things a bit clearer.

Regards,

--
Anca Vamanu
www.voice-system.ro


ha do wrote:

HI Anca

i am trying to use the b2b_request + b2b_reply

route{
...
if(is_method(INVITE)   !(src_ip == 192.168.1.249  src_port ==5060))
{
if (! t_newtran()){
sl_reply_error();
exit;
};

b2b_init_request(top hiding);
exit;
};

route(1);
}
route[1] {
if(is_method(INVITE)) {
route(b2b_request);
t_on_reply(2);
}
else
if(status==200)
route(b2b_reply);
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[b2b_request] {
  xlog(b2b_request cucku ($ci)\n);
force_rtp_proxy();
}
route[b2b_reply] {
  xlog(b2b_reply cucku ($ci)\n);
force_rtp_proxy();
}

i get the errors : 
ERROR:nathelper:force_rtp_proxy: Unable to parse body

and
 DBG:tm:utimer_routine: timer routine:4,tl=0xb615e9a8 next=(nil), 
timeout=2900
 DBG:tm:timer_routine: timer routine:3,tl=0xb615c6f4 next=(nil), 
timeout=29

 DBG:tm:delete_handler: removing 0xb615c690
 DBG:tm:delete_cell: delete_cell 0xb615c690: can't delete -- still 
reffed (1)



===
 DBG:core:get_hdr_field: cseq CSeq: 2 INVITE
 DBG:core:parse_headers: flags=8
 DBG:tm:t_reply_matching: hash 21530 label 76806763 branch 0
 DBG:tm:t_reply_matching: REF_UNSAFE: after is 2
 DBG:tm:t_reply_matching: reply matched (T=0xb615e85c)!
 DBG:tm:t_check: end=0xb615e85c
 DBG:tm:reply_received: org. status uas=0, uac[0]=100 local=2 is_invite=1)
 DBG:tm:t_should_relay_response: T_code=0, new_code=180
 DBG:tm:local_reply: branch=0, save=0, winner=0
 DBG:tm:local_reply: Passing provisional reply 180 to FIFO application
 DBG:tm:run_trans_callbacks: trans=0xb615e85c, callback type 1024, id 
0 entered

 DBG:b2b_entities:b2b_parse_key: hash_index = [111]  - local_index= [0]
 DBG:core:parse_headers: flags=
 DBG:core:get_hdr_field: content_length=0
 DBG:core:get_hdr_field: found end of header
 DBG:b2b_entities:b2b_tm_cback: Received a reply with statuscode = 180
 DBG:core:parse_headers: flags=
 DBG:b2b_entities:b2b_new_dlg: 'To' header ALREADY PARSED: 
sip:1...@192.168.1.249

 DBG:b2b_entities:b2b_new_dlg: Not an initial request
 DBG:core:parse_to_param: tag=bfad35cdb22f09f741816636d344f54b-19f0
 DBG:core:parse_to: end of header reached, state=29
 DBG:core:parse_to: display={}, 
ruri={sip:0873000...@192.168.1.249;user=phone}

 DBG:core:print_rr_body: current rr is sip:192.168.1.249;lr=on
 DBG:core:print_rr_body: out rr [sip:192.168.1.249;lr=on]
 DBG:core:print_rr_body: we have 1 records
 DBG:b2b_entities:b2b_tm_cback: Created new dialog structure 0xb61618c0
 DBG:core:print_rr_body: current rr is sip:192.168.1.249;lr=on
 DBG:core:print_rr_body: out rr [sip:192.168.1.249;lr=on]
 DBG:core:print_rr_body: we have 1 records
 DBG:b2b_logic:b2bl_parse_key: hash_index = [623]  - local_index= [0]
 DBG:core:parse_headers: flags=
 DBG:b2b_entities:b2b_parse_key: hash_index = [346]  - local_index= [0]
 

Re: [OpenSIPS-Users] Need help on flag in usrloc

2010-01-06 Thread Bogdan-Andrei Iancu
Hi Ha,

the two flags are different and may have different values - one is used 
as NAT marker, the other one is used as SIP-based pinging marker.

so, you can use different flags and both of them will be saved in cflag 
mask.

Regards,
Bogdan

ha do wrote:
 Hi Bogdan

 got it :)

 1 more question about the flag
 modparam(nathelper, sipping_bflag, 7)
 modparam(usrloc, nat_bflag, 7)

 the modem ADSL will close the port after 3 mins(some minutes), so 
 Opensips should send OPTION message(sip ping) to modem to keep port 
 that should open for UA

 the sipping_blag of nathelper module should be the same value as 
 nat_bflag of usrloc ? or the cflag of usrloc just  has a value??


 Thank you
 Ha`

 --- On *Tue, 1/5/10, Bogdan-Andrei Iancu /bog...@voice-system.ro/* 
 wrote:


 From: Bogdan-Andrei Iancu bog...@voice-system.ro
 Subject: Re: [OpenSIPS-Users] Need help on flag in usrloc
 To: OpenSIPS users mailling list users@lists.opensips.org
 Date: Tuesday, January 5, 2010, 7:20 AM

 Hi Ha,

 the NAT branch flag you use is 7 (nat_bflag) and in usrloc you
 find the
 branch flags in the cflags (contact flags) field. The cflags is a
 mask
 with all the branch flags: 192 = 128 (2^7) + 64 (2^6)

 Regards,
 Bogdan


 ha do wrote:
  Hi all
 
  i am successfull to check the UA behind NAT but i dont know what
 value
  of the flag will be stored in the usrloc
 
  Could someone please let me know the value of Nated UA flag,
 that is
  stored in usrloc
 
 
  my config :
  modparam(nathelper, natping_interval,180)
  modparam(nathelper, ping_nated_only, 1)
  modparam(nathelper, sipping_bflag, 7)
  modparam(nathelper, sipping_from, sip:cu...@kamailio.org
 /mc/compose?to=cu...@kamailio.org)
  modparam(registrar|nathelper, received_avp, $avp(i:80))
  modparam(usrloc, nat_bflag, 7)
 
 
  route{
 
  
  route(4);
  if (method==REGISTER)
  {
  if (isflagset(5)) {
  setbflag(6);
  setbflag(7);
  }
  if (!save(location))
  sl_reply_error();
  exit;
  }
  }
  route[4]{
  force_rport();
  if (nat_uac_test(19)) {
  if (method==REGISTER) {
  fix_nated_register();
  } else {
  fix_nated_contact();
  }
  setflag(5);
  }
  return;
  }
 
  mysql select * from location\G
  *** 1. row ***
 id: 12
   username: 1000
 domain: NULL
contact: sip:1...@192.168.1.2:12280;rinstance=a4752f45bdc3ddd3
   received: sip:210.245.35.150:12280
   path: NULL
expires: 2010-01-05 17:48:56
  q: -1.00
 callid: YjE1NWJmYWYyYWMzZDg2ZDc5MjY0NDQyMGE5NDEwM2E.
   cseq: 2
  last_modified: 2010-01-05 16:48:56
   flags: 0
  cflags: 192
  user_agent: eyeBeam release 1004p stamp 31962
socket: udp:118.69.193.198:5060
methods: 5951
 
 
  Thank you
  Ha`
 
 
 
 
 
 
  ___
  Users mailing list
  Users@lists.opensips.org /mc/compose?to=us...@lists.opensips.org
  http://lists.opensips.org/cgi-bin/mailman/listinfo/users



 -- 
 Bogdan-Andrei Iancu
 www.voice-system.ro


 ___
 Users mailing list
 Users@lists.opensips.org /mc/compose?to=us...@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users


 

 ___
 Users mailing list
 Users@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users
   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] How to limit channel on bunch of called DIDs?

2010-01-06 Thread Johnson Pajayat
Hi!

I'm a newbie with OpenSIPS administration and configuration and I searched
on the mail archives regarding limiting the channels but only found the site
regarding Concurrent calls limitation. I've been trying to grasp the whole
idea about AVPops and dialog module but unfortunately I'm having a hard time
understanding it. If ever, does anyone here be kind enough to point me to
any available documents or sample configurations file that will help me
limit the channels on inbound calls to a single or group of DIDs?
Implementation will be done static first and hopefully once I got the whole
idea, will be implementing a dynamic one.

Thank you very much.

--conpaj--
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] How to increase cache in opensips tables

2010-01-06 Thread Ahmed Munir
Hi,

I'm using permission module's function check_source_address(), the problem
I'm facing is that I can not add not than more 8 IPs in address table, but I
want to permit more than 100 IPs. I only want to use these IPs on group 0
what I am using. When I enter more than 8 IPs in address table and make a
call, I observe a message i.e. not found in hash table.My opensips.cfg
configuration for check_source_address() is listed below;

  if (is_method(INVITE)  check_source_address(0)) {
log(INVITE###);
ds_select_domain(1,4);
forward();
route(1);
log(#END);
setflag(1);
}


Kindly advise me how to increase cache of OpenSIPs database tables so I can
reslove my case. Further added, how can I enter domain name in 'ip' column
section of address table i.e. abc.com can't be used and gives me an error,
kindly advise this well.

-- 
Regards,

Ahmed Munir
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] INVITE as a variable?

2010-01-06 Thread Brad Bendy
Hi list,

Im trying to find a way to extract and the re-write the number in the
INVITE itself, Mera and a few other switch manufacturers are all of a
sudden are trying to route on INVITE and not the To field, when the
INVITE has a prefix in it they fail to complete the call then. I can't
seem to find any built in variables or way to do that, is it just not
possible to rewrite the INVITE or am I missing something? It would seem
pretty straight forward but no way to do this, am I just blind?

Thanks for any help

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] INVITE as a variable?

2010-01-06 Thread Alex Balashov
On the contrary, rewriting the Request URI (which is what I assume you 
mean by rewrite the number in the INVITE itself), including the user 
part of the Request URI (the part before the @), is one of the most 
basic functions the proxy *can* perform.

See the pseudovariables $ru (and for the user part specifically, $rU, or 
$rd for the domain and $rp for the port).  They are mutable:

$rU = 39824234234;
$rd = sip.biloxi.net;

-- Alex

On 01/06/2010 09:52 AM, Brad Bendy wrote:

 Hi list,

 Im trying to find a way to extract and the re-write the number in the
 INVITE itself, Mera and a few other switch manufacturers are all of a
 sudden are trying to route on INVITE and not the To field, when the
 INVITE has a prefix in it they fail to complete the call then. I can't
 seem to find any built in variables or way to do that, is it just not
 possible to rewrite the INVITE or am I missing something? It would seem
 pretty straight forward but no way to do this, am I just blind?

 Thanks for any help



 ___
 Users mailing list
 Users@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-- 
Alex Balashov - Principal
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct  : (+1) (678) 954-0671

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to limit channel on bunch of called DIDs?

2010-01-06 Thread Bogdan-Andrei Iancu
Hi Johnson,

The idea is to use dialog profiles to keep trace of the ongoing calls 
(per resource). As a first step take a look at the following tutorial:

http://www.opensips.org/Resources/DocsTutConcurrentCalls

Regards,
Bogdan

Johnson Pajayat wrote:
 Hi!

 I'm a newbie with OpenSIPS administration and configuration and I 
 searched on the mail archives regarding limiting the channels but only 
 found the site regarding Concurrent calls limitation. I've been 
 trying to grasp the whole idea about AVPops and dialog module but 
 unfortunately I'm having a hard time understanding it. If ever, does 
 anyone here be kind enough to point me to any available documents or 
 sample configurations file that will help me limit the channels on 
 inbound calls to a single or group of DIDs? Implementation will be 
 done static first and hopefully once I got the whole idea, will be 
 implementing a dynamic one.

 Thank you very much.

 --conpaj--

 

 ___
 Users mailing list
 Users@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users
   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] nathelper+rtpproxy between IPv6 client and IPv4 client

2010-01-06 Thread Bogdan-Andrei Iancu
Hi,

for bridging IPv4 and IPv6 you can use opensips (nathelper) for doing 
the signalling part and rtpproxy for doing the RTP part.

You need to configure opensips to listen both on an IPv4 and IPv6 
interface (and do the routing between). Also RTPproxy does bridging 
between 2 interface (ipv4 and ipv6).

Regards,
Bogdan

agung nugroho wrote:
 I want to ask you all about nathelper modules. Is it can be using with 
 rtpproxy??
 i reasearch about how to connect IPv6 client with IPv4 client using 
 IMS. And they can communicate with tripleplay.
 what is client software that i can use?? coz i use monster as a client 
 but it cannnot connect to the server.

 can anyone help me???

 sorry for my bad english. Thanks before.
 

 ___
 Users mailing list
 Users@lists.opensips.org
 http://lists.opensips.org/cgi-bin/mailman/listinfo/users
   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] OpenSIPS 1.6 drouting: drouting:dr_load_routing_info: route 1 does not exist

2010-01-06 Thread Mike O'Connor
Hi All

I'm trying to get drouting working, the issue is I can not work out
which tables and field its complaining about when it give the error.

'drouting:dr_load_routing_info: route 1 does not exist'

In 'dr_rules' I have a routeid of 1 for a number of rows, and if I
change this to a 2 or 5 then the above error changes.

So the issue must be that I have not place a route some where with the
id of 1, problem I can not find where to add this record.

Any help greatly appreciated.

Mike


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] How to limit channel on bunch of called DIDs?

2010-01-06 Thread Johnson Pajayat
Hello Bogdan,

I appreciate a lot your response regarding my inquiry. I've been reading
that tutorial as well as the AVPops and dialog modules documentation for
about a month now. I tried to adapt that route block for inbound calls and
here's a portion of what I have on our OpenSIPS 1.5 config file:

---
modparam(dialog, dlg_flag, 4)
modparam(dialog, profiles_with_value, inbound)

..

} else if (uri=~sip:1234567...@.*) {
route(3);
rewritehost(111.222.111.222);

...

route[3]
{
## have we done our checking on this call?
if(!isflagset(31))
{
# user has max channel limit set as preference
if(is_avp_set($avp(s:channels)/n) 
avp_check($avp(s:channels), gt/i:0))
{
# get the current calls for DID
get_profile_size(inbound,$tU,$var(calls));

# check within limit
if($avp(s:channels)  $var(calls))
{
xlog(L_INFO, Call control: DID '$tU'
currently has
   '$var(calls)' of '$avp(s:channels)'
active calls before this one\n);
$var(setprofile) = 1;
}
else
{
xlog(L_INFO, Call control: DID '$tU'
channel limit exceeded [$var(calls)/$avp(s:channels)]
\n);
send_reply(487, Request Terminated:
Channel limit exceeded\n);
exit;
}
}
else
{
$var(setprofile) = 0;
}

call_control();

switch ($retcode)
{
case 2:
# Call with no limit
case 1:
# Call with a limit under callcontrol
management (either prepaid or postpaid)
break;
case -1:
# Not enough credit (prepaid call)
xlog(L_INFO, Call control: not enough
credit for prepaid call\n);
acc_rad_request(402);
sl_send_reply(402, Not enough credit);
exit;
break;
case -2:
# Locked by call in progress (prepaid call)
xlog(L_INFO, Call control: prepaid call
locked by another call in progress\n);
acc_rad_request(403);
sl_send_reply(403, Call locked by another
call in progress);
exit;
break;
default:
# Internal error (message parsing,
communication, ...)
xlog(L_INFO, Call control: internal
server error\n);
acc_rad_request(500);
sl_send_reply(500, Internal server
error);
exit;
}

if($var(setprofile)  0)
{
create_dialog();
set_dlg_profile(inbound,$tU);
}

## mark checking done
setflag(31);
}
}



And here are the logs appearing on /var/log/messages:

Jan  6 05:53:22 opensips cdrtool[20998]: MaxSessionTime Duration=36000
callid=28a35ce1-4d7a175-25a58...@124.123.234.229 From=si
p:12135551...@124.123.234.229
p%3a12135551...@124.123.234.229Gateway=124.123.234.229
To=sip:1234567...@124.123.234.241:5060
;user=phone
Jan  6 05:53:22 opensips cdrtool[20998]: MaxSessionTime=unlimited
Type=postpaid callid=28a35ce1-4d7a175-25a58...@124.123.234.229 BillingParty=
12135551...@124.123.234.229
Jan  6 05:53:22 opensips call-control[21263]: Call id
28a35ce1-4d7a175-25a58...@64.77.234.229 of 12135551...@124.123.234.229 to
 sip:1234567...@124.123.234.241:5060;user=phone is postpaid not limited
Jan  6 05:53:22 opensips /usr/local/sbin/opensips[1636]: new branch at
sip:1234567...@111.222.111.222:5060;user=phone
Jan  6 05:53:22 opensips /usr/local/sbin/opensips[1640]: incoming reply
Jan  6 05:53:22 opensips /usr/local/sbin/opensips[1636]: incoming reply
Jan  6 05:53:22 opensips /usr/local/sbin/opensips[1636]: ACC: transaction
answered: timestamp=1262786002;method=INVITE;from_t
ag=14fe61da-25a58684-e5ea4d40;to_tag=as6a53f46c;call_id=
28a35ce1-4d7a175-25a58...@64.77.234.229;code=200;reason=OK
Jan  6 05:53:22 opensips