[OpenSIPS-Users] Transfer problem with Opensips as a load balancer

Vlad Paiu vladpaiu at opensips.org
Mon Dec 5 10:57:28 CET 2011


Hello,

Try something like this :

if ( get_dialog_info("host","$var(x)","caller","$fU") ) {
	xlog("caller $fU has another ongoing, on host $var(x)\n")
	#route to host $var(x)
} else if ( get_dialog_info("host","$var(x)","callee","$rU") ) {
	xlog("callee $rU has another ongoing, on host $var(x)\n")
	#route to host $var(x)
} else {
	create_dialog();
	$dlg_val(caller) = $fU;
	$dlg_val(callee) = $rU;
	load_balance("1","pstn");
	$dlg_val(host) = $du;
}


Regards,

Vlad Paiu
OpenSIPS Developer


On 12/04/2011 04:25 PM, Nick Khamis wrote:
> Schneur,
>
> I'm running into this problem now as well. Do you want to work on
> this together?
>
> Ninus.
>
> On Thu, Dec 1, 2011 at 1:04 PM, Schneur Rosenberg
> <rosenberg11219 at gmail.com>  wrote:
>> Bogdan there is too little info about this online, can you please help
>> me a bit more with this, how do I write the if statement, and how do I
>> set a variable for the first call, and how do I retrieve which server
>> was used for the first call.
>> On Wed, Nov 23, 2011 at 9:46 PM, Schneur Rosenberg
>> <rosenberg11219 at gmail.com>  wrote:
>>> thank you Bogdan
>>>
>>> On Wed, Nov 23, 2011 at 7:32 PM, Bogdan-Andrei Iancu
>>> <bogdan at opensips.org>  wrote:
>>>> Hi Schneur,
>>>>
>>>> What you have to do is to change the way you distribute the call among the
>>>> asterisk boxes in such a way that all calls in which a user is involved to
>>>> be on the same box (so that the transfers will work).
>>>>
>>>> How to do that? with a mixed routing logic. When you receive a new call, do:
>>>>     - check if caller or callee are already involved into an existing call on
>>>> a certain box. if so, route to that box
>>>>     - default is to do LB as you do now.
>>>>
>>>> For the check part, you need to use the dialog module (to be dialog
>>>> stateful), set in some dialog variables the caller / callee / box (to be
>>>> remembered later) and query via get_dialog_info() function -
>>>> http://www.opensips.org/html/docs/modules/1.7.x/dialog.html#id294051
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> On 11/23/2011 06:48 PM, Schneur Rosenberg wrote:
>>>>> I'm using Opensips as a Load balancer and as a registrar, so basically
>>>>> all phones are registered to the Opensips, all Incoming calls hit the
>>>>> opensips server which forwards the call to asterisk with load
>>>>> balancing, asterisk decides what to do with the call ie IVR voicemail
>>>>> etc and if the call needs to be sent to a phone asterisk will send it
>>>>> back to opensips and opensips will send it to the phone.
>>>>>
>>>>> Outgoing calls are sent to asterisk via load balancing and asterisk
>>>>> decides how to terminate the call.
>>>>>
>>>>> This setup helps me load balance all calls and also removes the
>>>>> registrar load from asterisk which does not handle registrations fine
>>>>> when there are approx 300 peers on my asterisk system.
>>>>>
>>>>> My problem is that sometimes when I do a transfer I get back from
>>>>> asterisk "SIP/2.0 481 Call leg/transaction does not exist.".
>>>>>
>>>>> The test call I've done was done by calling from phone 1 a phone
>>>>> number which hits our system, so what happened is phone invited
>>>>> opensips to the DID, opensips sent the call to Asterisk server 1, then
>>>>> the DID called in and opensips sent it to Asterisk server 2, Asterisk
>>>>> server 2 saw that this did should ring on a phone so it sent it back
>>>>> to opensips which properly terminated the call to phone 2, then phone
>>>>> 1 wanted to transfer call to a outside phone, so it sent a invite to
>>>>> opensips with the phone number to call, opensips sent call to Asterisk
>>>>> server 2, then when user on phone 1 hit transfer, phone sent a refer
>>>>> to Asterisk 1, and asterisk 1 retuned a NOTIFY with
>>>>> Subscription-state: terminated;reason=noresource. and SIP/2.0 481 Call
>>>>> leg/transaction does not exist.
>>>>>
>>>>> Can anyone please help me solve this problem.
>>>>>
>>>>> thank you
>>>>> S. Rosenberg
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>
>>>>
>>>> --
>>>> Bogdan-Andrei Iancu
>>>> OpenSIPS Founder and Developer
>>>> OpenSIPS solutions and "know-how"
>>>>
>>>>
>> _______________________________________________
>> Users mailing list
>> 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



More information about the Users mailing list