[OpenSIPS-Users] 回复: 回复: 回复: 回复: 回复: Dialog Concurrency Control Issue.

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Jul 15 13:33:11 CEST 2014


Hi,
OK, that's good. But not enough - as Liviu mentioned in a separate 
email, the test and set you do (check the number of dialogs and create a 
new dialog) is not an atomic operation, considering the fact that 
opensips is doing multi-processing. You should protect that test&set 
operation with a lock, to make it atomic. see:
http://www.opensips.org/html/docs/modules/1.11.x/cfgutils.html#id294109

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 15.07.2014 14:29, jing wrote:
> hi,Bogdan
> Thanks for your help.
> I changed the script as fllow. Then when I start the second call ,it 
> send 503.
> if (is_method("INVITE")) {
> xlog("active dialog is $stat(active_dialogs)");
> if ($DLG_count>=1){
>  xlog("we have more than 1 call(s) - currently $stat(active_dialogs) \n");
> sl_send_reply("503", "Service Unavailable");
> exit;
> }
> # create dialog with timeout
> if ( !create_dialog("B") ) {
> send_reply("500","Internal Server Error");
> exit;
> }
> setflag(ACC_DO); # do accounting
> }
> Thanks,
> Regards,
> jing
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Bogdan-Andrei Iancu"<bogdan at opensips.org>;
> *发送时间:* 2014年7月15日(星期二) 下午5:35
> *收件人:* "jing "<605507247 at qq.com>; "users"<users at lists.opensips.org>;
> *主题:* Re: 回复: 回复: [OpenSIPS-Users] 回复: 回复: Dialog 
> Concurrency Control Issue.
>
> Place a xlog message inside the IF statement, to see if you ever get 
> there :
>
>
>                 if ($stat(active_dialogs)>=1){
>                 xlog("we have more than 1 call(s) - currently 
> $stat(active_dialogs) \n");
>                 sl_send_reply("503", "Service Unavailable");
> *   exit;*
>                 }
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developer
> http://www.opensips-solutions.com
> On 15.07.2014 12:28, jing wrote:
>> hi,Bogdan
>> I have tried ,  but it is no change to have exit.
>> regards,
>>
>>
>> ------------------ 原始邮 件 ------------------
>> *发件人:* "Bogdan-Andrei Iancu"<bogdan at opensips.org>;
>> *发送时间:* 2014年7月15日(星期二) 下午5:26
>> *收件人:* "jing "<605507247 at qq.com>; "users"<users at lists.opensips.org>;
>> *主题:* Re: 回复: [OpenSIPS-Users] 回复: 回复: Dialog Concurrency 
>> Control Issue.
>>
>> Because you need to have an "exit;" after the sl_send_reply():
>>
>>
>>                 if ($stat(active_dialogs)>=1){
>>                 sl_send_reply("503", "Service Unavailable");
>> *   exit;*
>>                 }
>>
>> Otherwise the script execution will continue.
>>
>> Regards,
>> Bogdan-Andrei Iancu
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>> On 15.07.2014 12:19, jing wrote:
>>> hi,Bogdan.
>>> I just want to limit the total number of active dialog. And now I 
>>> have 2 questions .
>>> I changed the script like this:
>>> if (is_method("INVITE")) {
>>>                 xlog("active dialog is $stat(active_dialogs)");
>>>                 xlog("dlgcount is $DLG_count");
>>>                 if ($stat(active_dialogs)>=1){
>>>                 sl_send_reply("503", "Service Unavailable");
>>>
>>>                 }
>>>                 # create dialog with timeout
>>>                 if ( !create_dialog("B") ) {
>>>                         send_reply("500","Internal Server Error");
>>>                         exit;
>>>                 }
>>>                 setflag(ACC_DO); # do accounting
>>>         }
>>> Then I started 3 dialog, they were all successful , but no 503 sent. 
>>> The log showed:
>>> active dialog is 2
>>> dlgcount is 2
>>> I used opensipsctl fifo command to show the dialog statistics, it 
>>> showed
>>> dialog:active_dialogs = 3.
>>> 1.what is wrong in my script ?
>>> 2. How to end the dialogs which have been active long time ,but have 
>>> no response.
>>> Or is there other way to limit the total number of active dialog?
>>> I am a newbie to opensips,  would you please tell me more detailed 
>>> advice?
>>> Very thanks!
>>> kind regards
>>>
>>>
>>> ------------------ 原始邮 件 ------------------
>>> *发件人:* "Bogdan-Andrei Iancu"<bogdan at opensips.org>;
>>> *发送时间:* 2014年7月15日(星期二) 下午4:43
>>> *收件人:* "users"<users at lists.opensips.org>; "jing "<605507247 at qq.com>;
>>> *主题:* Re: [OpenSIPS-Users] 回复: 回复: Dialog Concurrency 
>>> Control Issue.
>>>
>>> Hi,
>>>
>>> I see you added the missing "exit" after the sl_send_reply() and you 
>>> do create the dialog for each INVITE (hopefully only for the initial 
>>> ones :) ).
>>>
>>> What seems to be the exact problem now ?
>>>
>>> Regards,
>>> Bogdan-Andrei Iancu
>>> OpenSIPS Founder and Developer
>>> http://www.opensips-solutions.com
>>> On 15.07.2014 05:21, jing wrote:
>>>> hi,Schneur.
>>>> Thanks for your advice.
>>>> But I did put the check before  create_dialog("B")  in the original 
>>>> oprnsips.cfg:
>>>> if (is_method("INVITE")) {
>>>>                 xlog("active dialog is $stat(active_dialogs)");
>>>>                 if ($stat(active_dialogs)>=1){
>>>>                 sl_send_reply("503", "Service Unavailable");
>>>>                 exit;
>>>>                 }
>>>>                 # create dialog with timeout
>>>>                 if ( !create_dialog("B") ) {
>>>>                         send_reply("500","Internal Server Error");
>>>>                         exit;
>>>>                 }
>>>>                 setflag(ACC_DO); # do accounting
>>>>         }
>>>>
>>>> So what is wrong in the script?
>>>> And I still want to know how to judge a call is "active_dialogs"?
>>>> Thanks a lot.
>>>> regards,
>>>> jing
>>>> ------------------ 原始 邮 件 ------------------
>>>> *发件人:* "Schneur Rosenberg";<rosenberg11219 at gmail.com>;
>>>> *发送时间:* 2014年7月14日(星期一) 晚上6:25
>>>> *收件人:* "OpenSIPS users mailling list"<users at lists.opensips.org>;
>>>> *主题:* Re: [OpenSIPS-Users]回复: Dialog Concurrency Control Issue.
>>>>
>>>> You need to do this before the create_dialog() call
>>>>
>>>> On Jul 14, 2014 10:33 AM, "jing" <605507247 at qq.com 
>>>> <mailto:605507247 at qq.com>> wrote:
>>>>
>>>>     Thanks for your reply.But I have another question, I used
>>>>      active_dialogs in the cfg file as this:
>>>>     if (is_method("INVITE")) {
>>>>                     if ($stat(active_dialogs)>=1){
>>>>                     sl_send_reply("503", "Service Unavailable");
>>>>                     }
>>>>     But it seems not right.
>>>>     I use sipp to test the limit ,but when the value of
>>>>     active_dialogs aim to the number I set ,
>>>>     opensips sent 503,but the value of active_dialogssitll increase.
>>>>     So I want to know how the value of this paramer comefrom.
>>>>     Or is there something wrong in my cfg document?
>>>>     regards,
>>>>     Jing
>>>>
>>>>
>>>>     ------------------ 原 始 邮 件 ------------------
>>>>     *发件人:* "Schneur Rosenberg [via OpenSIPS (Open SIP
>>>>     Server)]"<[hidden email]
>>>>     <http://user/SendEmail.jtp?type=node&node=7592371&i=0>>;
>>>>     *发送时间:* 2014年7月14日(星期一) 下午2:08
>>>>     *收件人:* "jing "<[hidden email]
>>>>     <http://user/SendEmail.jtp?type=node&node=7592371&i=1>>;
>>>>     *主题:* Re: Dialog Concurrency Control Issue.
>>>>
>>>>     Very simple, before creating a new dialog check how many open
>>>>     dialogs exist.
>>>>
>>>>     On Jul 14, 2014 9:05 AM, "jing" <[hidden email]
>>>>     <http://user/SendEmail.jtp?type=node&node=7592369&i=0>> wrote:
>>>>
>>>>         hi,Bogdan
>>>>
>>>>
>>>>          I want to limit the total number of active dialogs ,what
>>>>         should I do ?
>>>>
>>>>         I found there are many questions about "Concurrent calls
>>>>         limitation " based
>>>>         on per user, it's not what I need.
>>>>
>>>>         I appreciate your advice very much,  more detailed the better.
>>>>
>>>>         Thanks,
>>>>         Regards,
>>>>         jing
>>>>
>>>>
>>>>
>>>>         --
>>>>         View this message in context:
>>>>         http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592368.html
>>>>         Sent from the OpenSIPS - Users mailing list archive at
>>>>         Nabble.com.
>>>>
>>>>         _______________________________________________
>>>>         Users mailing list
>>>>         [hidden email]
>>>>         <http://user/SendEmail.jtp?type=node&node=7592369&i=1>
>>>>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>>     _______________________________________________
>>>>     Users mailing list
>>>>     [hidden email]
>>>>     <http://user/SendEmail.jtp?type=node&node=7592369&i=2>
>>>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>>     ------------------------------------------------------------------------
>>>>     If you reply to this email, your message will be added to the
>>>>     discussion below:
>>>>     http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp6172931p7592369.html
>>>>
>>>>     To unsubscribe from Dialog Concurrency Control Issue., click here.
>>>>     NAML
>>>>     <http://opensips-open-sip-server.1449251.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>>>
>>>>     ------------------------------------------------------------------------
>>>>     View this message in context: 回复: Dialog Concurrency Control
>>>>     Issue.
>>>>     <http://opensips-open-sip-server.1449251.n2.nabble.com/Dialog-Concurrency-Control-Issue-tp7592371.html>
>>>>     Sent from the OpenSIPS - Users mailing list archive
>>>>     <http://opensips-open-sip-server.1449251.n2.nabble.com/OpenSIPS-Users-f1449235.html>
>>>>     at Nabble.com.
>>>>
>>>>     _______________________________________________
>>>>     Users mailing list
>>>>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140715/db59cbdb/attachment-0001.htm>


More information about the Users mailing list