[OpenSIPS-Users] I need some help in attr matching while forming the Branch .

Sasmita Panda spanda at 3clogic.com
Wed Oct 25 13:57:43 UTC 2023


Hi Ben ,

Please correct me if I am wrong .

*$avp(attr) : sales,level20,en,true*
*$hdr(Call-Info) : sales,en*












* if ($(avp(attr){s.index, $hdr(Call-Info)}) != NULL)
    {                               xlog("found $hdr(Call-Info)  in
$avp(attr) \n");                                if (next_branches()){
                                  t_on_failure("1");
        }                          }                         else {
                       sl_send_reply(500,"Unable to load contacts");
                        exit;                         }*

In this case , although $hdr(Call-Info) is a substring of $avp(attr) still
it's going in the else block and giving me *500  Unable to load contacts*
.

Does the substring must contain continuous values ?




*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Mon, Oct 23, 2023 at 8:54 PM Sasmita Panda <spanda at 3clogic.com> wrote:

> Thank u so much for the confirmation.
>
> Although I have tested this in the same way and it's working . Still after
> you confirmation I am double sure that I am in the right track .
>
> Thank u once again .
>
> On Mon, 23 Oct 2023, 19:00 Ben Newlin, <Ben.Newlin at genesys.com> wrote:
>
>> Yes, based on your description of the problem that transformation should
>> work. We use that transformation to test a comma-separated list for the
>> existence of a value in the same way.
>>
>>
>>
>> Ben Newlin
>>
>>
>>
>> *From: *Users <users-bounces at lists.opensips.org> on behalf of Sasmita
>> Panda <spanda at 3clogic.com>
>> *Date: *Monday, October 23, 2023 at 2:13 AM
>> *To: *OpenSIPS users mailling list <users at lists.opensips.org>
>> *Subject: *Re: [OpenSIPS-Users] I need some help in attr matching while
>> forming the Branch .
>>
>> * EXTERNAL EMAIL - Please use caution with links and attachments *
>>
>>
>> ------------------------------
>>
>> There are some changes in the requirements now .
>>
>>
>>
>> Although I appreciate your suggestion, I will go with
>> script transformation . But not in a different way . * In the register I
>> will get set of comma separated values in Call-Info *
>>
>> *header and will save that in attr column . *
>>
>>
>>
>> Agent1: call-info : en,galileo,level1,true
>>
>> Agent2 : call-info : en,spanish,lenovo,true
>>
>> Agent3: call-info : en,galileo,sales,level1,true
>>
>>
>>
>> 1st Invite :
>>
>> *call-info : en,galileo,true*  (I have to match the contact in which
>> this the substring of Registered contacts Attr . ex : Agent1 and Agent3
>> will the matching agents here  )
>>
>>
>>
>> 2nd Invite :
>>
>> *call-info : en,true* (All there agents are matching this critaria )
>>
>>
>>
>> 3rd Invite :
>>
>> *call-info : spanish,lenovo,true *(Agent2 will match the criteria )
>>
>>
>>
>> This is kind of substring matching . Here the challenge for me is , the
>> number of values in the Invite header is not fixed , That can be 2 , that
>> can be 4 that can be 7 . If every comma separated value is present in the
>> Attr field then that contact will get call else not .
>>
>>
>>
>>
>>
>> *#Test for existence of string in another if ($(var(strtosearch){s.index,
>> $var(str)}) != NULL)     xlog("found $var(sstr) in $var(strtosearch)\n");*
>>
>>
>>
>> *So will this help me  in this case ? *
>>
>>
>>
>>
>> *Thanks & Regards*
>>
>> *Sasmita Panda*
>>
>> *Senior Network Testing and Software Engineer*
>>
>> *3CLogic , ph:07827611765*
>>
>>
>>
>>
>>
>> On Wed, Oct 18, 2023 at 7:10 PM Ben Newlin <Ben.Newlin at genesys.com>
>> wrote:
>>
>> Sasmita,
>>
>>
>>
>> Your examples all contain mixed use of semicolons and commas. Without any
>> description or context, it’s very difficult to tell what or how you expect
>> these to match.
>>
>>
>>
>> Having said that, I recommend making use of OpenSIPS transformations [1].
>> The parameters list transformations [2] specifically, as they operate on
>> semicolon separated “key=value” pairs, just like you have.
>>
>>
>>
>> Depending on what operation you are expecting with respect to the commas,
>> you may be able to combine that with the string select transformation [3]
>> to get your desired outcome.
>>
>>
>>
>> [1] https://www.opensips.org/Documentation/Script-Tran-3-2
>>
>> [2] https://www.opensips.org/Documentation/Script-Tran-3-2#toc60
>>
>> [3] https://www.opensips.org/Documentation/Script-Tran-3-2#toc7
>>
>>
>>
>> Ben Newlin
>>
>>
>>
>> *From: *Users <users-bounces at lists.opensips.org> on behalf of Sasmita
>> Panda <spanda at 3clogic.com>
>> *Date: *Wednesday, October 18, 2023 at 6:34 AM
>> *To: *OpenSIPS users mailling list <users at lists.opensips.org>
>> *Subject: *Re: [OpenSIPS-Users] I need some help in attr matching while
>> forming the Branch .
>>
>> * EXTERNAL EMAIL - Please use caution with links and attachments *
>>
>>
>> ------------------------------
>>
>> Hi All ,
>>
>>
>>
>> Any help on this ?
>>
>>
>>
>>
>> *Thanks & Regards*
>>
>> *Sasmita Panda*
>>
>> *Senior Network Testing and Software Engineer*
>>
>> *3CLogic , ph:07827611765*
>>
>>
>>
>>
>>
>> On Tue, Oct 17, 2023 at 7:54 PM Sasmita Panda <spanda at 3clogic.com> wrote:
>>
>> Hi All ,
>>
>>
>>
>> My requirements seem complicated to me. I dont know whether I am right or
>> wrong .
>>
>> I am using opensips 1.11 (I have opensips 3.2 as well )
>>
>>
>>
>> *scenario 1: *
>>
>> 989898 - is registered from 3 different  contact with different call-info
>> header . and I saved the call-info header in attr column while saving data
>> .
>>
>>
>>
>> 1 contact : call-info : x=hr,network;y=sales,z=marketing
>>
>> 2nd contact : call-info : x=hr;y=sales,z=marketing
>>
>> 3rd contact : call-info : x=hr,network;y=sales,z=marketing
>>
>>
>>
>> INVITE :
>>
>>     call-info :  x=hr;y=sales
>>
>>
>>
>> Now while forming a branch for this INVITE , how do I compare this
>> call-info with attr to get all the contact and then do serial forking on
>> this ?
>>
>>
>>
>> *scenario 2: *
>>
>> 989898 - is registered from 3 different  contact with different call-info
>> header . and I saved the call-info header in attr column while saving data
>> .
>>
>>
>>
>> 1 contact : call-info : x=hr,network;y=sales,z=marketing
>>
>> 2nd contact : call-info : x=hr;y=sales,z=marketing
>>
>> 3rd contact : call-info : x=hr,network;y=sales,z=marketing
>>
>>
>>
>> INVITE :
>>
>>     call-info :  call-info : x=hr,network;y=sales,z=marketing
>>
>>
>>
>> In this I am getting only 1 contact where there is exact match . And I am
>> able to gove call to that contact .
>>
>>
>>
>> I am stuck on the 1st scenario . I am thinking of exec module to use on
>> this . But not getting any better examples of how I do this . Please
>> anybody help me out .
>>
>>
>>
>> Any kind of help is appreciated . thank you in advance .
>>
>>
>>
>>
>>
>> *Thanks & Regards*
>>
>> *Sasmita Panda*
>>
>> *Senior Network Testing and Software Engineer*
>>
>> *3CLogic , ph:07827611765*
>>
>> _______________________________________________
>> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20231025/2c784e65/attachment-0001.html>


More information about the Users mailing list