[SR-Users] Re: How to check for presence of a file from a route? (Or any other way to tell kamailio not to accept new calls)

2023-11-13 Thread David Villasmil via sr-users
Or better yet use an htable

On Mon, 13 Nov 2023 at 13:31, Henning Westerholt via sr-users <
sr-users@lists.kamailio.org> wrote:

> Hello,
>
> just to add another common method, you could also just use a cfg file
> variable that you can modify later with kamcmd, kamcli etc.. There is a
> prepared variable (pstn..) in the default cfg.
>
> Cheers,
>
> Henning
>
>
> --
> Henning Westerholt - https://skalatan.de/blog/
> Kamailio services - https://gilawa.com
>
>
>
> > -Original Message-
> > From: Daniel-Constantin Mierla via sr-users  >
> > Sent: Montag, 13. November 2023 11:46
> > To: Kamailio (SER) - Users Mailing List 
> > Cc: Daniel-Constantin Mierla 
> > Subject: [SR-Users] Re: How to check for presence of a file from a
> route? (Or
> > any other way to tell kamailio not to accept new calls)
> >
> > On 13.11.23 11:17, Benoit Panizzon via sr-users wrote:
> > > Hi
> > >
> > > I'm still looking for a better way to tell Kamailio that we want to
> > > enter 'maintenance' and STAY in maintenance after a restart.
> > >
> > > Maintenance is: Reject all messages without totag with 503 to prevent
> > > creating new dialogues.
> > >
> > > I could use a shared pv and the use kamcmd pv.shvSet to toggle it.
> > >
> > > But when kamailio is restarted, that pv is also reset to it's initial
> > > state. Not good, if I want to make sure the node stays in maintenance
> > > mode after a restart as for example after pushing a config change via
> > > ansible.
> > >
> > > So what comes to my mind is to check for the presence of a file.
> > >
> > > something like:
> > >
> > > route[CHECK_MAINTENANCE]
> > > {
> > > if (!has_totag() && is_method("INVITE")) {
> > > if (file_exist("/etc/kamailio/maintenance.flag")) {
> > > xlog("L_ERR", "Maintenance flag present! Rejecting
> > INVITE\n");
> > > t_send_reply("503", "Maintenance mode - no new
> > calls accepted");
> > > exit;
> > > }
> > > }
> > > }
> >
> > I would really avoid checking/reading a file for every new sip call,
> especially on
> > production system with decent volume of calls. But if suits your needs
> and
> > system, look at corex module, there is a function to read the content of
> a file.
> >
> > I would rather find a solution where the state is kept in memory, like
> still using
> > $shv(...) and change kamailio.cfg to init in maintenance mode via pv
> > parameter which can set $shv(...) at startup, or using htable with
> database
> > backend that loads at startup.
> >
> > Cheers,
> > Daniel
> >
> > --
> > Daniel-Constantin Mierla (@ asipto.com)
> > twitter.com/miconda -- linkedin.com/in/miconda Kamailio Consultancy and
> > Development Services
> >
> > __
> > Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
> > send an email to sr-users-le...@lists.kamailio.org
> > Important: keep the mailing list in the recipients, do not reply only to
> the
> > sender!
> > Edit mailing list options or unsubscribe:
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Henning Westerholt via sr-users
Hello,

I just realized that I quoted the wrong registrar module link (for the IMS) 
earlier.

Yes, to enable use_domain would be also my next guess. Strange that it does not 
seems to work, but the reg_fectch_contacts probably just uses the given string. 
It probably needs further digging in the code.

Cheers,

Henning

> -Original Message-
> From: Mohammad Hossein Ahmadi via sr-users 
> Sent: Montag, 13. November 2023 14:24
> To: sr-users@lists.kamailio.org
> Cc: Mohammad Hossein Ahmadi 
> Subject: [SR-Users] Re: Inconsistent behavior between reg_fetch_contacts
> (registrar module) and reginfo_handle_notify (pua_reginfo module)?
> 
> Hi,
> 
> Yes, I learned about the inconsistent behavior between reginfo_handle_notify
> and reg_fetch_contacts by going through the debug log and seeing the DB
> queries.
> 
> I even tried to avoid the problem by changing the Kamailio C code (extract_aor
> function in registrar/common.c) and recompiling it, but that doesn't seem
> right to me. Both registrar and pua_reginfo appear to be central and widely
> used modules, and unlikely to have such a bug. So it has to be a problem with
> my config, but I can't seem to spot it. (I have already played with
> "use_domain" parameter in usrloc)
> 
> Thanks,
> Mohammad
> 
> Henning Westerholt wrote:
> > Hello,
> >
> > strange. You probably did already that, but if you activate debug log
> > level you should be able to also see the database queries that are
> > executed, just to double check. If might be just a bug in the cfg or 
> > possible
> also in the code.
> >
> > Cheers,
> >
> > Henning
> >
> > >   -Original Message-
> > >  From: Mohammad Hossein Ahmadi via sr-users
> > > sr-users(a)lists.kamailio.org
> > >  Sent: Montag, 13. November 2023 13:14
> > >  To: sr-users(a)lists.kamailio.org
> > >  Cc: Mohammad Hossein Ahmadi m.ahmadi(a)sinacomsys.com
> > >  Subject: [SR-Users] Re: Inconsistent behavior between
> > > reg_fetch_contacts  (registrar module) and reginfo_handle_notify
> (pua_reginfo module)?
> > >
> > >  (sending again since I noticed my previous reply might not have
> > > been sent
> > >  properly)
> > >
> > >  Hi Henning,
> > >
> > >  The script already does that. As seen at lines 380-382 here:
> > >
> > > https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/
> > > exa
> > >  mples/kamailio.cfg
> > >
> > >  ...
> > >  $var(uri) = "sip:"+$avp(to)+"@"+DOMAIN;  if
> > > (reg_fetch_contacts("location", "$var(uri)", "caller")) { ...
> > >
> > >  I even printed the value of $var(uri) to the log to make sure it
> > > was correct, and  it was!
> > > ("sip:b...@ims.mnc001.mcc001.3gppnetwork.org")*
> > >
> > >  I'm still perplexed.
> > >
> > >  Any idea which would help resolve the problem would be greatly
> appreciated.
> > >
> > >  Regards,
> > >  Mohammad
> > >
> > >  *actually I have changed the mnc and mcc numbers here
> > >
> > >  Henning Westerholt wrote:
> > >   Hello,
> > >
> > >  I think you could just give the proper URI with domain part in the
> > > variable, according to the documentation:
> > >
> > > https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.
> > > ht
> > >  ml#id…
> > >
> > >  Cheers,
> > >
> > >  Henning
> > >
> > >  >   -Original Message-
> > >  >  From: Mohammad Hossein Ahmadi via sr-users  >
> > > sr-users(a)lists.kamailio.org
> > >  >  Sent: Mittwoch, 8. November 2023 14:03  >  To:
> > > sr-users(a)lists.kamailio.org  >  Cc: Mohammad Hossein Ahmadi
> > > m.ahmadi(a)sinacomsys.com  >  Subject: [SR-Users]
> > > Inconsistent behavior between  > reg_fetch_contacts  (registrar
> > > module) and reginfo_handle_notify
> > >   (pua_reginfo module)?
> > >   >
> > >  >  Hello everyone,
> > >  >
> > >  >  I have previously set up Kamailio 5.7.2 IMS configuration  >
> > > (including P-CSCF, S-  CSCF and I-CSCF) and successfully made voice
> > > > calls. Now I'm trying to set up  an IP-SM-GW AS using the example here
> > >   (with some tweaks):
> > >   >
> > >  >
> > > https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/
> > >  > exa
> > >  >  mples/kamailio.cfg
> > >  >  Currently I'm trying to send the SMS using a SIP software client
> (MicroSIP).
> > >  >
> > >  >  The problem is, while the SMS is received at the AS and stored
> > > in  > the database,  it does not send it to the callee.
> > >  >
> > >  >  While troubleshooting the problem, I've found that  >
> > > reg_fetch_contacts("location", "$var(uri)", "caller") in  >
> > > route[SEND_SMS]  cannot find the contact which was added by  >
> > > reginfo_handle_notify("location") in route[NOTIFY] in the usrloc  >
> > > database. By  tracing the problem more, I've found that  >
> > > reginfo_handle_notify (when  handling reg event NOTIFY) adds the  >
> > > complete AoR in the "username" field in  the location table, e.g. as
> > > > bob(a)ims.mnc001.mcc001.3gppnetwork.org.org". But  >
> > > reg_fetch_contacts (when trying to send the SMS) looks up the table
> > > > using  only the user 

[SR-Users] Re: dlg_req_within kamailio 5.7 CSeq values

2023-11-13 Thread Carsten Bock via sr-users
Hi,

I wrote it ;-)

You could check a branch with some changes regarding CSeq Handling:
https://github.com/kamailio/kamailio/tree/carstenbock/dialog_cseq_update/src/modules

I use my branch to send frequent in-dialog INFO messages (USSD,
https://github.com/carstenbock/ussd-poc), which works fine. I haven't found
the time yet to do more testing, so I haven't done a PR for it yet.

Thanks,
Carsten

--
Carsten Bock I Chief Technology Innovation Officer & Founder

ng-voice GmbH

Trostbrücke 1 I 20457 Hamburg I Germany
T +49 1511 5942983 I www.ng-voice.com

Registry Office at Local Court Hamburg, HRB 120189
Managing Directors: Dr. David Bachmann, Carsten Bock, Quirin Maderspacher


Am Mo., 13. Nov. 2023 um 11:46 Uhr schrieb Daniel-Constantin Mierla via
sr-users :

> Hello,
> On 10.11.23 15:57, Jonathan Hunter via sr-users wrote:
>
>
>
> Hi All,
>
>
>
> I am playing around with the dlg_req_within to send  a REINVITE to toggle
> some rtpengine parameters and this works fine.
>
>
>
> The first time I use the command after tracking the dialog, it sends a
> REINVITE with an incremented CSEQ value.
>
>
>
> However when I issue it again, it sends another REINVITE but with the same
> CSEQ value, so again 2 for example.
>
>
>
> How can you ensure its incremented or can you set it somehow?
>
>
>
> As would like to generate at least 2 reinvites per dialog.
>
> I haven't implemented this function, so I am not sure if it leverages it,
> but the dialog module has a modparam to enable cseq tracking, which is used
> by uac module for auth functionality. If you haven't set that parameter,
> try with it and see if it does the magic.
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla (@ asipto.com)twitter.com/miconda -- 
> linkedin.com/in/miconda
> Kamailio Consultancy and Development Services
>
> __
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Mohammad Hossein Ahmadi via sr-users
Hi,

Yes, I learned about the inconsistent behavior between reginfo_handle_notify 
and reg_fetch_contacts by going through the debug log and seeing the DB queries.

I even tried to avoid the problem by changing the Kamailio C code (extract_aor 
function in registrar/common.c) and recompiling it, but that doesn't seem right 
to me. Both registrar and pua_reginfo appear to be central and widely used 
modules, and unlikely to have such a bug. So it has to be a problem with my 
config, but I can't seem to spot it. (I have already played with "use_domain" 
parameter in usrloc)

Thanks,
Mohammad

Henning Westerholt wrote:
> Hello,
> 
> strange. You probably did already that, but if you activate debug log level 
> you should be
> able to also see the database queries that are executed, just to double 
> check. If might be
> just a bug in the cfg or possible also in the code.
> 
> Cheers,
> 
> Henning
> 
> >   -Original Message-
> >  From: Mohammad Hossein Ahmadi via sr-users 
> > sr-users(a)lists.kamailio.org
> >  Sent: Montag, 13. November 2023 13:14
> >  To: sr-users(a)lists.kamailio.org
> >  Cc: Mohammad Hossein Ahmadi m.ahmadi(a)sinacomsys.com
> >  Subject: [SR-Users] Re: Inconsistent behavior between reg_fetch_contacts
> >  (registrar module) and reginfo_handle_notify (pua_reginfo module)?
> >  
> >  (sending again since I noticed my previous reply might not have been sent
> >  properly)
> >  
> >  Hi Henning,
> >  
> >  The script already does that. As seen at lines 380-382 here:
> >  https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/exa
> >  mples/kamailio.cfg
> >  
> >  ...
> >  $var(uri) = "sip:"+$avp(to)+"@"+DOMAIN;
> >  if (reg_fetch_contacts("location", "$var(uri)", "caller"))
> > { ...
> >  
> >  I even printed the value of $var(uri) to the log to make sure it was 
> > correct, and
> >  it was! ("sip:b...@ims.mnc001.mcc001.3gppnetwork.org")*
> >  
> >  I'm still perplexed.
> >  
> >  Any idea which would help resolve the problem would be greatly appreciated.
> >  
> >  Regards,
> >  Mohammad
> >  
> >  *actually I have changed the mnc and mcc numbers here
> >  
> >  Henning Westerholt wrote:
> >   Hello,
> > 
> >  I think you could just give the proper URI with domain part in the
> >  variable, according to the documentation:
> >  https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.ht
> >  ml#id…
> > 
> >  Cheers,
> > 
> >  Henning
> > 
> >  >   -Original Message-
> >  >  From: Mohammad Hossein Ahmadi via sr-users
> >  > sr-users(a)lists.kamailio.org
> >  >  Sent: Mittwoch, 8. November 2023 14:03
> >  >  To: sr-users(a)lists.kamailio.org
> >  >  Cc: Mohammad Hossein Ahmadi m.ahmadi(a)sinacomsys.com
> >  >  Subject: [SR-Users] Inconsistent behavior between
> >  > reg_fetch_contacts  (registrar module) and reginfo_handle_notify
> >   (pua_reginfo module)?
> >   >
> >  >  Hello everyone,
> >  >
> >  >  I have previously set up Kamailio 5.7.2 IMS configuration
> >  > (including P-CSCF, S-  CSCF and I-CSCF) and successfully made voice
> >  > calls. Now I'm trying to set up  an IP-SM-GW AS using the example here
> >   (with some tweaks):
> >   >
> >  > https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/
> >  > exa
> >  >  mples/kamailio.cfg
> >  >  Currently I'm trying to send the SMS using a SIP software client 
> > (MicroSIP).
> >  >
> >  >  The problem is, while the SMS is received at the AS and stored in
> >  > the database,  it does not send it to the callee.
> >  >
> >  >  While troubleshooting the problem, I've found that
> >  > reg_fetch_contacts("location", "$var(uri)", "caller")
> > in
> >  > route[SEND_SMS]  cannot find the contact which was added by
> >  >  reginfo_handle_notify("location") in route[NOTIFY] in the usrloc
> >  > database. By  tracing the problem more, I've found that
> >  > reginfo_handle_notify (when  handling reg event NOTIFY) adds the
> >  > complete AoR in the "username" field in  the location table, e.g. as
> >  > bob(a)ims.mnc001.mcc001.3gppnetwork.org.org". But
> >  > reg_fetch_contacts (when trying to send the SMS) looks up the table
> >  > using  only the user part in the "username" field, e.g. "bob".
> > So it
> >  > cannot find the  callee contact and the configuration assumes the
> >  > callee is still not registered;  so it tries to send out a SUBSCRIBE
> >  > every time it tries to send an SMS to the  callee, instead of actually 
> > sending
> >   the SMS.
> >   >
> >  >  Does anybody have any idea on what could have caused this
> >  > inconsistent  behavior between reginfo_handle_notify and
> >   reg_fetch_contacts?
> >   > 
> >
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Henning Westerholt via sr-users
Hello,

strange. You probably did already that, but if you activate debug log level you 
should be able to also see the database queries that are executed, just to 
double check. If might be just a bug in the cfg or possible also in the code.

Cheers,

Henning

> -Original Message-
> From: Mohammad Hossein Ahmadi via sr-users 
> Sent: Montag, 13. November 2023 13:14
> To: sr-users@lists.kamailio.org
> Cc: Mohammad Hossein Ahmadi 
> Subject: [SR-Users] Re: Inconsistent behavior between reg_fetch_contacts
> (registrar module) and reginfo_handle_notify (pua_reginfo module)?
> 
> (sending again since I noticed my previous reply might not have been sent
> properly)
> 
> Hi Henning,
> 
> The script already does that. As seen at lines 380-382 here:
> https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/exa
> mples/kamailio.cfg
> 
> ...
> $var(uri) = "sip:"+$avp(to)+"@"+DOMAIN;
> if (reg_fetch_contacts("location", "$var(uri)", "caller")) { ...
> 
> I even printed the value of $var(uri) to the log to make sure it was correct, 
> and
> it was! ("sip:b...@ims.mnc001.mcc001.3gppnetwork.org")*
> 
> I'm still perplexed.
> 
> Any idea which would help resolve the problem would be greatly appreciated.
> 
> Regards,
> Mohammad
> 
> *actually I have changed the mnc and mcc numbers here
> 
> Henning Westerholt wrote:
> > Hello,
> >
> > I think you could just give the proper URI with domain part in the
> > variable, according to the documentation:
> > https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.ht
> > ml#id…
> >
> > Cheers,
> >
> > Henning
> >
> > >   -Original Message-
> > >  From: Mohammad Hossein Ahmadi via sr-users
> > > sr-users(a)lists.kamailio.org
> > >  Sent: Mittwoch, 8. November 2023 14:03
> > >  To: sr-users(a)lists.kamailio.org
> > >  Cc: Mohammad Hossein Ahmadi m.ahmadi(a)sinacomsys.com
> > >  Subject: [SR-Users] Inconsistent behavior between
> > > reg_fetch_contacts  (registrar module) and reginfo_handle_notify
> (pua_reginfo module)?
> > >
> > >  Hello everyone,
> > >
> > >  I have previously set up Kamailio 5.7.2 IMS configuration
> > > (including P-CSCF, S-  CSCF and I-CSCF) and successfully made voice
> > > calls. Now I'm trying to set up  an IP-SM-GW AS using the example here
> (with some tweaks):
> > >
> > > https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/
> > > exa
> > >  mples/kamailio.cfg
> > >  Currently I'm trying to send the SMS using a SIP software client 
> > > (MicroSIP).
> > >
> > >  The problem is, while the SMS is received at the AS and stored in
> > > the database,  it does not send it to the callee.
> > >
> > >  While troubleshooting the problem, I've found that
> > > reg_fetch_contacts("location", "$var(uri)", "caller") in
> > > route[SEND_SMS]  cannot find the contact which was added by
> > >  reginfo_handle_notify("location") in route[NOTIFY] in the usrloc
> > > database. By  tracing the problem more, I've found that
> > > reginfo_handle_notify (when  handling reg event NOTIFY) adds the
> > > complete AoR in the "username" field in  the location table, e.g. as
> > > bob(a)ims.mnc001.mcc001.3gppnetwork.org.org". But
> > > reg_fetch_contacts (when trying to send the SMS) looks up the table
> > > using  only the user part in the "username" field, e.g. "bob". So it
> > > cannot find the  callee contact and the configuration assumes the
> > > callee is still not registered;  so it tries to send out a SUBSCRIBE
> > > every time it tries to send an SMS to the  callee, instead of actually 
> > > sending
> the SMS.
> > >
> > >  Does anybody have any idea on what could have caused this
> > > inconsistent  behavior between reginfo_handle_notify and
> reg_fetch_contacts?
> > >  __
> > >  Kamailio - Users Mailing List - Non Commercial Discussions To
> > > unsubscribe  send an email to sr-users-leave(a)lists.kamailio.org
> > >  Important: keep the mailing list in the recipients, do not reply
> > > only to the  sender!
> > >  Edit mailing list options or unsubscribe:
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
> send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Dispatcher list reloading itself from file?!?

2023-11-13 Thread Benoit Panizzon via sr-users
Hi Daniel

> there is no automatic reload, be sure you do not have some timer routine
> (inside kamailio.cfg or cron.d) that does it, or an external application
> (e.g., management application).

Thank you, that was the cause. We have a cronjob which downloads rules
from a spit call blocklist supplier, puts them in various textdb htables
and mtrees and reloads them.

That script also preformed dispatcher.reload.

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G-Leiter Commerce Kunden
__

Zurlindenstrasse 29 Tel  +41 61 826 93 00
CH-4133 PrattelnFax  +41 61 826 93 01
Schweiz Web  http://www.imp.ch
__
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Mohammad Hossein Ahmadi via sr-users
(sending again since I noticed my previous reply might not have been sent 
properly)

Hi Henning,

The script already does that. As seen at lines 380-382 here:
https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/examples/kamailio.cfg

...
$var(uri) = "sip:"+$avp(to)+"@"+DOMAIN;
if (reg_fetch_contacts("location", "$var(uri)", "caller")) {
...

I even printed the value of $var(uri) to the log to make sure it was correct, 
and it was! ("sip:b...@ims.mnc001.mcc001.3gppnetwork.org")*

I'm still perplexed.

Any idea which would help resolve the problem would be greatly appreciated.

Regards,
Mohammad

*actually I have changed the mnc and mcc numbers here

Henning Westerholt wrote:
> Hello,
> 
> I think you could just give the proper URI with domain part in the variable, 
> according to
> the documentation:
> https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.html#id…
> 
> Cheers,
> 
> Henning
> 
> >   -Original Message-
> >  From: Mohammad Hossein Ahmadi via sr-users 
> > sr-users(a)lists.kamailio.org
> >  Sent: Mittwoch, 8. November 2023 14:03
> >  To: sr-users(a)lists.kamailio.org
> >  Cc: Mohammad Hossein Ahmadi m.ahmadi(a)sinacomsys.com
> >  Subject: [SR-Users] Inconsistent behavior between reg_fetch_contacts
> >  (registrar module) and reginfo_handle_notify (pua_reginfo module)?
> >  
> >  Hello everyone,
> >  
> >  I have previously set up Kamailio 5.7.2 IMS configuration (including 
> > P-CSCF, S-
> >  CSCF and I-CSCF) and successfully made voice calls. Now I'm trying to set 
> > up
> >  an IP-SM-GW AS using the example here (with some tweaks):
> >  https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/exa
> >  mples/kamailio.cfg
> >  Currently I'm trying to send the SMS using a SIP software client 
> > (MicroSIP).
> >  
> >  The problem is, while the SMS is received at the AS and stored in the 
> > database,
> >  it does not send it to the callee.
> >  
> >  While troubleshooting the problem, I've found that
> >  reg_fetch_contacts("location", "$var(uri)", "caller") in
> > route[SEND_SMS]
> >  cannot find the contact which was added by
> >  reginfo_handle_notify("location") in route[NOTIFY] in the usrloc database. 
> > By
> >  tracing the problem more, I've found that reginfo_handle_notify (when
> >  handling reg event NOTIFY) adds the complete AoR in the "username" field in
> >  the location table, e.g. as 
> > bob(a)ims.mnc001.mcc001.3gppnetwork.org.org". But
> >  reg_fetch_contacts (when trying to send the SMS) looks up the table using
> >  only the user part in the "username" field, e.g. "bob". So it cannot
> > find the
> >  callee contact and the configuration assumes the callee is still not 
> > registered;
> >  so it tries to send out a SUBSCRIBE every time it tries to send an SMS to 
> > the
> >  callee, instead of actually sending the SMS.
> >  
> >  Does anybody have any idea on what could have caused this inconsistent
> >  behavior between reginfo_handle_notify and reg_fetch_contacts?
> >  __
> >  Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
> >  send an email to sr-users-leave(a)lists.kamailio.org
> >  Important: keep the mailing list in the recipients, do not reply only to 
> > the
> >  sender!
> >  Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Mohammad Hossein Ahmadi via sr-users


  
  
Hi Henning,


The script already does that. As seen at lines 380-382 here:
https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/examples/kamailio.cfg



...

$var(uri) = "sip:"+$avp(to)+"@"+DOMAIN;
if (reg_fetch_contacts("location", "$var(uri)", "caller")) {
...



I even printed the value of $var(uri) to the log to make sure it
  was correct, and it was! ("sip:b...@ims.mnc001.mcc001.3gppnetwork.org")*


I'm still perplexed.



Any idea which would help resolve the problem would be greatly
  appreciated.


Regards,
Mohammad



*actually I have changed the mnc and mcc numbers here


On 11/13/2023 12:36 PM, Henning
  Westerholt wrote:


  Hello,

I think you could just give the proper URI with domain part in the variable, according to the documentation:
https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.html#idm356

Cheers,

Henning


  
-Original Message-
From: Mohammad Hossein Ahmadi via sr-users 
Sent: Mittwoch, 8. November 2023 14:03
To: sr-users@lists.kamailio.org
Cc: Mohammad Hossein Ahmadi 
Subject: [SR-Users] Inconsistent behavior between reg_fetch_contacts
(registrar module) and reginfo_handle_notify (pua_reginfo module)?

Hello everyone,

I have previously set up Kamailio 5.7.2 IMS configuration (including P-CSCF, S-
CSCF and I-CSCF) and successfully made voice calls. Now I'm trying to set up
an IP-SM-GW AS using the example here (with some tweaks):
https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/exa
mples/kamailio.cfg
Currently I'm trying to send the SMS using a SIP software client (MicroSIP).

The problem is, while the SMS is received at the AS and stored in the database,
it does not send it to the callee.

While troubleshooting the problem, I've found that
reg_fetch_contacts("location", "$var(uri)", "caller") in route[SEND_SMS]
cannot find the contact which was added by
reginfo_handle_notify("location") in route[NOTIFY] in the usrloc database. By
tracing the problem more, I've found that reginfo_handle_notify (when
handling reg event NOTIFY) adds the complete AoR in the "username" field in
the location table, e.g. as "b...@ims.mnc001.mcc001.3gppnetwork.org". But
reg_fetch_contacts (when trying to send the SMS) looks up the table using
only the user part in the "username" field, e.g. "bob". So it cannot find the
callee contact and the configuration assumes the callee is still not registered;
so it tries to send out a SUBSCRIBE every time it tries to send an SMS to the
callee, instead of actually sending the SMS.

Does anybody have any idea on what could have caused this inconsistent
behavior between reginfo_handle_notify and reg_fetch_contacts?
__
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the
sender!
Edit mailing list options or unsubscribe:

  

  

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: pseudo variable in include_file not possible

2023-11-13 Thread Henning Westerholt via sr-users
Hello,

not sure if the environment replacement there works in later versions, have not 
tested it.

You could just use another template system like ansible etc.. to deploy the 
name dynamically.

Cheers,

Henning


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



From: Bernd Krueger-Knauber via sr-users 
Sent: Montag, 13. November 2023 12:15
To: sr-users@lists.kamailio.org
Cc: Bernd Krueger-Knauber 
Subject: [SR-Users] pseudo variable in include_file not possible

Hi,

since we use git also for our kamailio stuff, we need to check in also host 
specific stuff.
(same kamailio.cfg but different addresses and ... )
For this I thought an include_file for different hosts would be nice, but I can 
not check in the different host specific files,
because I can not use something like:

include_file "$HN(n).cfg"

It is not allowed in kamailio 5.6.x
Or better: the pseudo variable is not replaced.

Is there a way to work arround, or is it possible to make it possible?

Best regards

Bernd
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: How to check for presence of a file from a route? (Or any other way to tell kamailio not to accept new calls)

2023-11-13 Thread Henning Westerholt via sr-users
Hello,

just to add another common method, you could also just use a cfg file variable 
that you can modify later with kamcmd, kamcli etc.. There is a prepared 
variable (pstn..) in the default cfg.

Cheers,

Henning


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



> -Original Message-
> From: Daniel-Constantin Mierla via sr-users 
> Sent: Montag, 13. November 2023 11:46
> To: Kamailio (SER) - Users Mailing List 
> Cc: Daniel-Constantin Mierla 
> Subject: [SR-Users] Re: How to check for presence of a file from a route? (Or
> any other way to tell kamailio not to accept new calls)
> 
> On 13.11.23 11:17, Benoit Panizzon via sr-users wrote:
> > Hi
> >
> > I'm still looking for a better way to tell Kamailio that we want to
> > enter 'maintenance' and STAY in maintenance after a restart.
> >
> > Maintenance is: Reject all messages without totag with 503 to prevent
> > creating new dialogues.
> >
> > I could use a shared pv and the use kamcmd pv.shvSet to toggle it.
> >
> > But when kamailio is restarted, that pv is also reset to it's initial
> > state. Not good, if I want to make sure the node stays in maintenance
> > mode after a restart as for example after pushing a config change via
> > ansible.
> >
> > So what comes to my mind is to check for the presence of a file.
> >
> > something like:
> >
> > route[CHECK_MAINTENANCE]
> > {
> > if (!has_totag() && is_method("INVITE")) {
> > if (file_exist("/etc/kamailio/maintenance.flag")) {
> > xlog("L_ERR", "Maintenance flag present! Rejecting
> INVITE\n");
> > t_send_reply("503", "Maintenance mode - no new
> calls accepted");
> > exit;
> > }
> > }
> > }
> 
> I would really avoid checking/reading a file for every new sip call, 
> especially on
> production system with decent volume of calls. But if suits your needs and
> system, look at corex module, there is a function to read the content of a 
> file.
> 
> I would rather find a solution where the state is kept in memory, like still 
> using
> $shv(...) and change kamailio.cfg to init in maintenance mode via pv
> parameter which can set $shv(...) at startup, or using htable with database
> backend that loads at startup.
> 
> Cheers,
> Daniel
> 
> --
> Daniel-Constantin Mierla (@ asipto.com)
> twitter.com/miconda -- linkedin.com/in/miconda Kamailio Consultancy and
> Development Services
> 
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
> send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: pseudo variable in include_file not possible

2023-11-13 Thread Daniel-Constantin Mierla via sr-users
Hello,

On 13.11.23 12:14, Bernd Krueger-Knauber via sr-users wrote:
> Hi,
>
> since we use git also for our kamailio stuff, we need to check in also
> host specific stuff.
> (same kamailio.cfg but different addresses and ... )
> For this I thought an include_file for different hosts would be nice,
> but I can not check in the different host specific files,
> because I can not use something like:
>
> |include_file "$HN(n).cfg"
>
> It is not allowed in kamailio 5.6.x
> Or better: the pseudo variable is not replaced.
>
> Is there a way to work arround, or is it possible to make it possible?
> |

the variables are mostly runtime elements (evaluated at every execution)
for kamailio.cfg, while include is a pre-processor directive which is
evaluated at reading the file, even before the file content is
understood by the interpreter (think of include_file directive as a copy
and paste to build a larger cfg file that is then passed to the
interpreter for parsing and understanding).

A way that might work, although I haven't tested it at all, is to
leverage environment variables that can be accessed via #!defenv, like:

- in shell

export HOSTFILECFG=abc.cfg

- in config file

#!defenv HOSTFILECFG

include_file HOSTFILECFG

Cheers,
Daniel

> ||

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
Kamailio Advanced Training -- asipto.com
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] pseudo variable in include_file not possible

2023-11-13 Thread Bernd Krueger-Knauber via sr-users

Hi,

since we use git also for our kamailio stuff, we need to check in also 
host specific stuff.

(same kamailio.cfg but different addresses and ... )
For this I thought an include_file for different hosts would be nice, 
but I can not check in the different host specific files,

because I can not use something like:

|include_file "$HN(n).cfg"

It is not allowed in kamailio 5.6.x
Or better: the pseudo variable is not replaced.

Is there a way to work arround, or is it possible to make it possible?

Best regards

Bernd
|__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: How to check for presence of a file from a route? (Or any other way to tell kamailio not to accept new calls)

2023-11-13 Thread Daniel-Constantin Mierla via sr-users
On 13.11.23 11:17, Benoit Panizzon via sr-users wrote:
> Hi
>
> I'm still looking for a better way to tell Kamailio that we want to
> enter 'maintenance' and STAY in maintenance after a restart.
>
> Maintenance is: Reject all messages without totag with 503 to prevent
> creating new dialogues.
>
> I could use a shared pv and the use kamcmd pv.shvSet to toggle it.
>
> But when kamailio is restarted, that pv is also reset to it's initial
> state. Not good, if I want to make sure the node stays in maintenance
> mode after a restart as for example after pushing a config change via
> ansible.
>
> So what comes to my mind is to check for the presence of a file.
>
> something like:
>
> route[CHECK_MAINTENANCE]
> {
>   if (!has_totag() && is_method("INVITE")) {
>   if (file_exist("/etc/kamailio/maintenance.flag")) {
>   xlog("L_ERR", "Maintenance flag present! Rejecting 
> INVITE\n");
>   t_send_reply("503", "Maintenance mode - no new calls 
> accepted");
>   exit;
>   }
>   }
> }

I would really avoid checking/reading a file for every new sip call,
especially on production system with decent volume of calls. But if
suits your needs and system, look at corex module, there is a function
to read the content of a file.

I would rather find a solution where the state is kept in memory, like
still using $shv(...) and change kamailio.cfg to init in maintenance
mode via pv parameter which can set $shv(...) at startup, or using
htable with database backend that loads at startup.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: dlg_req_within kamailio 5.7 CSeq values

2023-11-13 Thread Daniel-Constantin Mierla via sr-users
Hello,

On 10.11.23 15:57, Jonathan Hunter via sr-users wrote:
>
>  
>
> Hi All,
>
>  
>
> I am playing around with the dlg_req_within to send  a REINVITE to
> toggle some rtpengine parameters and this works fine.
>
>  
>
> The first time I use the command after tracking the dialog, it sends a
> REINVITE with an incremented CSEQ value.
>
>  
>
> However when I issue it again, it sends another REINVITE but with the
> same CSEQ value, so again 2 for example.
>
>  
>
> How can you ensure its incremented or can you set it somehow?
>
>  
>
> As would like to generate at least 2 reinvites per dialog.
>
I haven't implemented this function, so I am not sure if it leverages
it, but the dialog module has a modparam to enable cseq tracking, which
is used by uac module for auth functionality. If you haven't set that
parameter, try with it and see if it does the magic.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Dispatcher list reloading itself from file?!?

2023-11-13 Thread Daniel-Constantin Mierla via sr-users
Hello,

On 10.11.23 15:25, Benoît Panizzon via sr-users wrote:
> Hi List
>
> I wanted to take one of our cores down gracefully by not destroy
> running dialogues to be able to implement a config change on Kamailio
> 5.5
>
> For this I did:
>
> kamctl dispatcher.remove ID SIP-URI, for every IC
>
> This worked fine, Kamailio is instructed to reply 503 on out of
> dialogue traffic from unknown endpoints causing the endpoints to
> re-route traffic to the other core, eventually making it possible to
> stop and restart Kamailio without harm.
>
> dialog count was steadily decreasing, until after about 10 minutes
> after removing the dispatcher URI's it started to increase again.
>
> kamctl dispatcher.list shows me, all dispatcher URI I removed are back!
>
> There is no ds_reload() being executed by calls.
>
> In the module description, I find no hint, that the dispatcher config
> is being reloaded from file in some interval or so.
>
> What could be the cause of my removed dispatcher suddenly being back?

there is no automatic reload, be sure you do not have some timer routine
(inside kamailio.cfg or cron.d) that does it, or an external application
(e.g., management application).

To double-check, once you run the remove command, do a dump of in-memory
records to be sure it was removed, maybe the command fails and there
should be error messages about that.

Cheers, Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy and Development Services
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] How to check for presence of a file from a route? (Or any other way to tell kamailio not to accept new calls)

2023-11-13 Thread Benoit Panizzon via sr-users
Hi

I'm still looking for a better way to tell Kamailio that we want to
enter 'maintenance' and STAY in maintenance after a restart.

Maintenance is: Reject all messages without totag with 503 to prevent
creating new dialogues.

I could use a shared pv and the use kamcmd pv.shvSet to toggle it.

But when kamailio is restarted, that pv is also reset to it's initial
state. Not good, if I want to make sure the node stays in maintenance
mode after a restart as for example after pushing a config change via
ansible.

So what comes to my mind is to check for the presence of a file.

something like:

route[CHECK_MAINTENANCE]
{
if (!has_totag() && is_method("INVITE")) {
if (file_exist("/etc/kamailio/maintenance.flag")) {
xlog("L_ERR", "Maintenance flag present! Rejecting 
INVITE\n");
t_send_reply("503", "Maintenance mode - no new calls 
accepted");
exit;
}
}
}



Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G-Leiter Commerce Kunden
__

Zurlindenstrasse 29 Tel  +41 61 826 93 00
CH-4133 PrattelnFax  +41 61 826 93 01
Schweiz Web  http://www.imp.ch
__
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: Inconsistent behavior between reg_fetch_contacts (registrar module) and reginfo_handle_notify (pua_reginfo module)?

2023-11-13 Thread Henning Westerholt via sr-users
Hello,

I think you could just give the proper URI with domain part in the variable, 
according to the documentation:
https://kamailio.org/docs/modules/5.5.x/modules/ims_registrar_scscf.html#idm356

Cheers,

Henning

> -Original Message-
> From: Mohammad Hossein Ahmadi via sr-users 
> Sent: Mittwoch, 8. November 2023 14:03
> To: sr-users@lists.kamailio.org
> Cc: Mohammad Hossein Ahmadi 
> Subject: [SR-Users] Inconsistent behavior between reg_fetch_contacts
> (registrar module) and reginfo_handle_notify (pua_reginfo module)?
> 
> Hello everyone,
> 
> I have previously set up Kamailio 5.7.2 IMS configuration (including P-CSCF, 
> S-
> CSCF and I-CSCF) and successfully made voice calls. Now I'm trying to set up
> an IP-SM-GW AS using the example here (with some tweaks):
> https://github.com/kamailio/kamailio/blob/master/src/modules/smsops/exa
> mples/kamailio.cfg
> Currently I'm trying to send the SMS using a SIP software client (MicroSIP).
> 
> The problem is, while the SMS is received at the AS and stored in the 
> database,
> it does not send it to the callee.
> 
> While troubleshooting the problem, I've found that
> reg_fetch_contacts("location", "$var(uri)", "caller") in route[SEND_SMS]
> cannot find the contact which was added by
> reginfo_handle_notify("location") in route[NOTIFY] in the usrloc database. By
> tracing the problem more, I've found that reginfo_handle_notify (when
> handling reg event NOTIFY) adds the complete AoR in the "username" field in
> the location table, e.g. as "b...@ims.mnc001.mcc001.3gppnetwork.org". But
> reg_fetch_contacts (when trying to send the SMS) looks up the table using
> only the user part in the "username" field, e.g. "bob". So it cannot find the
> callee contact and the configuration assumes the callee is still not 
> registered;
> so it tries to send out a SUBSCRIBE every time it tries to send an SMS to the
> callee, instead of actually sending the SMS.
> 
> Does anybody have any idea on what could have caused this inconsistent
> behavior between reginfo_handle_notify and reg_fetch_contacts?
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe
> send an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe: