Re: [SR-Users] Question about textops

2020-06-26 Thread Henning Westerholt
Hi Mojtaba,

not looked in the code – but it could be related to be able to check with this 
function for request and replies. Replies will have the method name in their 
CSEQ.

If you have a requirement that is not available right now in the module, it can 
be of course extended (e.g. by pull request).

Cheers,

Henning

--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com<https://gilawa.com/>

From: sr-users  On Behalf Of Mojtaba
Sent: Friday, June 26, 2020 12:43 PM
To: Kamailio (SER) - Users Mailing List 
Subject: Re: [SR-Users] Question about textops

Any idea?
On Wed, 24 Jun 2020, 14:26 Mojtaba, mailto:mes...@gmail.com>> 
wrote:
Hello,
Some confusing things while developing in Kamailio:
In is_method_f function in textops module, the code checks the HDR_CSEQ_F in 
msg also, and if the method name appears in CSEQ_F, The result is returned TRUE.
These question will  arise why in this function, the CSEQ field in message will 
check?
if(parse_headers(msg, HDR_CSEQ_F, 0)!=0 || msg->cseq==NULL)

{

LM_ERR("cannot parse cseq header\n");

return -1; /* should it be 0 ?!?! */

}

if(m->s==0)

return (get_cseq(msg)->method_id>len)?1:-1;

else

return (get_cseq(msg)->method_id==METHOD_OTHER

&& get_cseq(msg)->method.len==m->len

&& (strncasecmp(get_cseq(msg)->method.s, m->s,
m->len)==0))?1:-1;

I think it would be nice to add new function like: is_cseq_method_f in module 
to avoid some problem understanding.

--
--Mojtaba Esfandiari.S
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Question about textops

2020-06-26 Thread Mojtaba
Any idea?

On Wed, 24 Jun 2020, 14:26 Mojtaba,  wrote:

> Hello,
> Some confusing things while developing in Kamailio:
> In is_method_f function in textops module, the code checks the HDR_CSEQ_F
> in msg also, and if the method name appears in CSEQ_F, The result is
> returned TRUE.
> These question will  arise why in this function, the CSEQ field in message
> will check?
> if(parse_headers(msg, HDR_CSEQ_F, 0)!=0 || msg->cseq==NULL)
> {
> LM_ERR("cannot parse cseq header\n");
> return -1; /* should it be 0 ?!?! */
> }
> if(m->s==0)
> return (get_cseq(msg)->method_id>len)?1:-1;
> else
> return (get_cseq(msg)->method_id==METHOD_OTHER
> && get_cseq(msg)->method.len==m->len
> && (strncasecmp(get_cseq(msg)->method.s, m->s,
> m->len)==0))?1:-1;
>
> I think it would be nice to add new function like: is_cseq_method_f in
> module to avoid some problem understanding.
>
> --
> --Mojtaba Esfandiari.S
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Question about textops

2020-06-25 Thread Mojtaba
Hello,
Some confusing things while developing in Kamailio:
In is_method_f function in textops module, the code checks the HDR_CSEQ_F
in msg also, and if the method name appears in CSEQ_F, The result is
returned TRUE.
These question will  arise why in this function, the CSEQ field in message
will check?
if(parse_headers(msg, HDR_CSEQ_F, 0)!=0 || msg->cseq==NULL)
{
LM_ERR("cannot parse cseq header\n");
return -1; /* should it be 0 ?!?! */
}
if(m->s==0)
return (get_cseq(msg)->method_id>len)?1:-1;
else
return (get_cseq(msg)->method_id==METHOD_OTHER
&& get_cseq(msg)->method.len==m->len
&& (strncasecmp(get_cseq(msg)->method.s, m->s,
m->len)==0))?1:-1;

I think it would be nice to add new function like: is_cseq_method_f in
module to avoid some problem understanding.

-- 
--Mojtaba Esfandiari.S
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users