[SR-Users] kamcmd dlg.end_dlg not working in shell script

David Villasmil david.villasmil.work at gmail.com
Tue Mar 16 17:26:10 CET 2021


Maybe the user executing from cron?

On Tue, 16 Mar 2021 at 16:16, Andrew Chen <achen at fuze.com> wrote:

> Now what's really interesting is that I echo'd the command I was going to
> execute:
>
> 2021-03-16T15:49:02.291485+00:00 ashmainkama51 /scripts/
> *get-call-from-hepic*.sh - *get-call-from-hepic*: Tue Mar 16 15:49:02 UTC
> 2021 executing kamcmd dlg.end_dlg h_entry: 401 h_id: 11452
>
>
> and this is exact copy of the kamcmd in the script but for some reason
> kamcmd returned invalid parameters:
>
>
> 2021-03-16T15:49:02.299040+00:00 ashmainkama51 /scripts/
> *get-call-from-hepic*.sh - *get-call-from-hepic*: Tue Mar 16 15:49:02 UTC
> 2021 status=error: 500 - Invalid parameters
>
>
> I don't get it.
>
> On Tue, Mar 16, 2021 at 11:49 AM Andrew Chen <achen at fuze.com> wrote:
>
>> Hi Llie
>> sure.
>>
>> loadmodule "*ctl*.so"
>>
>> #modparam("*ctl*", "binrpc", "tcp:*:2046")
>>
>> #modparam("*ctl*", "binrpc_max_body_size", 20)
>>
>> #modparam("*ctl*", "binrpc_struct_max_body_size", 3)
>>
>> modparam("*ctl*", "binrpc", "unix:/var/run/kamailio/kamailio_*ctl*")
>>
>> modparam("*ctl*", "binrpc", "tcp:*:2046")
>>
>> modparam("*ctl*", "binrpc_max_body_size", 20)
>>
>> modparam("*ctl*", "binrpc_struct_max_body_size", 3)
>>
>>
>> So the script is actually kicked off by another script that is executed
>> by a cronjob
>>
>>
>> Been doing more troubleshooting and I'm starting to think this is some
>> cron issue but can't really isolate the issue to that 100%.  Need more
>> testing data to confirm.
>>
>> On Tue, Mar 16, 2021 at 9:27 AM Ilie Soltanici <iliusha.md at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> Can you post here parameters for the ctl module and what is the user
>>> you're running the script?
>>>
>>> Regards,
>>>
>>>
>>>
>>> On Mon, 15 Mar 2021 at 21:04, Andrew Chen <achen at fuze.com> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Coming back to this.  Any other suggestions here?
>>>>
>>>> Thanks
>>>>
>>>> On Wed, Mar 10, 2021 at 9:24 AM Andrew Chen <achen at fuze.com> wrote:
>>>>
>>>>> So the strange thing is that I use kamcmd to get the list of users and
>>>>> that works.  Are there special permissions needed to delete them?
>>>>>
>>>>> On Wed, Mar 10, 2021 at 4:38 AM Ilie Soltanici <iliusha.md at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Sorry, there is actually no need for the callid argument, I mixed it
>>>>>> up with another command.
>>>>>> As Daniel recommended try to check the permissions. Which user the
>>>>>> script is running with and what are the permission for /var/run/kamailio/
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> On Wed, 10 Mar 2021 at 09:26, Ilie Soltanici <iliusha.md at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> kamcmd dlg.end_dlg $h_entry $h_id
>>>>>>>>
>>>>>>>
>>>>>>> I think you are missing the callid parameter when calling kamcmd
>>>>>>> command:
>>>>>>> Try kamcmd dlg.end_dlg $h_entry $h_id $SIPCallID
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> On Tue, 9 Mar 2021 at 13:03, Andrew Chen <achen at fuze.com> wrote:
>>>>>>>
>>>>>>>> Thanks guys.
>>>>>>>> Here is the whole function I created:
>>>>>>>>
>>>>>>>> function FollowUpAction
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>>   SIPCallID=$1
>>>>>>>>
>>>>>>>>
>>>>>>>>   if [ $callStatus -ge 7 ] && [ $callStatus -le 15 ]; then
>>>>>>>>
>>>>>>>>     GetDialogID $SIPCallID
>>>>>>>>
>>>>>>>>     log "$(date) Found active dialog on completed call.  Delete
>>>>>>>> call using $h_entry $h_id on SIP Call-ID $SIPCallID" >>
>>>>>>>> deleted-calls-list.txt
>>>>>>>>
>>>>>>>>     kamcmd dlg.end_dlg $h_entry $h_id
>>>>>>>>
>>>>>>>>   fi
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Mar 9, 2021 at 6:53 AM David Villasmil <
>>>>>>>> david.villasmil.work at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Specially if you don’t show the script source.
>>>>>>>>>
>>>>>>>>> On Tue, 9 Mar 2021 at 08:51, Daniel-Constantin Mierla <
>>>>>>>>> miconda at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> it is hard to say why your shell script does not work, when the
>>>>>>>>>> command runs ok in the terminal. Maybe missing/empty parameters, or
>>>>>>>>>> insufficient access rights, ...
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>> Daniel
>>>>>>>>>> On 08.03.21 20:23, Andrew Chen wrote:
>>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I have a script that cleans up hanging dialog and for some
>>>>>>>>>> reason, executing 'kamcmd dlg.end_dlg' does not seem to work.  Below I log
>>>>>>>>>> events of stuck calls and as you can see it just keeps logging the same
>>>>>>>>>> call until I manually run the kamcmd either in bash shell prompt or in
>>>>>>>>>> kamcmd cli:
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:00:04.347807+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:00:04
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:01:02.531822+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:01:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:02:02.689823+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:02:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:03:02.044960+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:03:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:04:02.436588+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:04:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:05:02.685572+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:05:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:06:02.775561+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:06:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:07:01.867021+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:07:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:08:01.888512+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:08:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:09:02.146887+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:09:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:10:02.649627+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:10:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:11:01.904948+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:11:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:12:01.932267+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:12:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:13:02.428128+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:13:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:14:02.617683+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:14:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:15:01.863099+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:15:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:16:01.650299+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:16:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:17:02.338576+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:17:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:18:01.743163+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:18:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:19:02.257369+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:19:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:20:01.624170+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:20:01
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>> 2021-03-08T19:21:02.287343+00:00 sjointgkama51
>>>>>>>>>> /scripts/get-call-from-hepic.sh - get-call-from-hepic: Mon Mar 8 19:21:02
>>>>>>>>>> UTC 2021 Found active dialog on completed call. Delete call using h_entry:
>>>>>>>>>> 1333 *h_id*: 11225 on SIP Call-ID 7j5r1msitcvg9siohoul
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thoughts?
>>>>>>>>>>
>>>>>>>>>> Thanks!
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Andy Chen
>>>>>>>>>> Sr. Telephony Lead Engineer
>>>>>>>>>> achen at fuze.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Confidentiality Notice: The information contained in this e-mail
>>>>>>>>>> and any
>>>>>>>>>> attachments may be confidential. If you are not an intended
>>>>>>>>>> recipient, you
>>>>>>>>>> are hereby notified that any dissemination, distribution or
>>>>>>>>>> copying of this
>>>>>>>>>> e-mail is strictly prohibited. If you have received this e-mail
>>>>>>>>>> in error,
>>>>>>>>>> please notify the sender and permanently delete the e-mail and any
>>>>>>>>>> attachments immediately. You should not retain, copy or use this
>>>>>>>>>> e-mail or
>>>>>>>>>> any attachment for any purpose, nor disclose all or any part of
>>>>>>>>>> the
>>>>>>>>>> contents to any other person. Thank you.*
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
>>>>>>>>>> Funding: https://www.paypal.me/dcmierla
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Kamailio (SER) - Users Mailing List
>>>>>>>>>> sr-users at lists.kamailio.org
>>>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> David Villasmil
>>>>>>>>> email: david.villasmil.work at gmail.com
>>>>>>>>> phone: +34669448337
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Andy Chen
>>>>>>>> Sr. Telephony Lead Engineer
>>>>>>>> 415 516 5535 (M)
>>>>>>>> achen at fuze.com
>>>>>>>>
>>>>>>>>
>>>>>>>> *Confidentiality Notice: The information contained in this e-mail
>>>>>>>> and any
>>>>>>>> attachments may be confidential. If you are not an intended
>>>>>>>> recipient, you
>>>>>>>> are hereby notified that any dissemination, distribution or copying
>>>>>>>> of this
>>>>>>>> e-mail is strictly prohibited. If you have received this e-mail in
>>>>>>>> error,
>>>>>>>> please notify the sender and permanently delete the e-mail and any
>>>>>>>> attachments immediately. You should not retain, copy or use this
>>>>>>>> e-mail or
>>>>>>>> any attachment for any purpose, nor disclose all or any part of the
>>>>>>>> contents to any other person. Thank you.*
>>>>>>>> _______________________________________________
>>>>>>>> Kamailio (SER) - Users Mailing List
>>>>>>>> sr-users at lists.kamailio.org
>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>> Kamailio (SER) - Users Mailing List
>>>>>> sr-users at lists.kamailio.org
>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Andy Chen
>>>>> Sr. Telephony Lead Engineer
>>>>> 415 516 5535 (M)
>>>>> achen@ <achen at thinkingphones.com>fuze.com
>>>>>
>>>>>
>>>>
>>>> --
>>>> Andy Chen
>>>> Sr. Telephony Lead Engineer
>>>> 415 516 5535 (M)
>>>> achen@ <achen at thinkingphones.com>fuze.com
>>>>
>>>>
>>>> *Confidentiality Notice: The information contained in this e-mail and
>>>> any
>>>> attachments may be confidential. If you are not an intended recipient,
>>>> you
>>>> are hereby notified that any dissemination, distribution or copying of
>>>> this
>>>> e-mail is strictly prohibited. If you have received this e-mail in
>>>> error,
>>>> please notify the sender and permanently delete the e-mail and any
>>>> attachments immediately. You should not retain, copy or use this e-mail
>>>> or
>>>> any attachment for any purpose, nor disclose all or any part of the
>>>> contents to any other person. Thank you.*
>>>> _______________________________________________
>>>> Kamailio (SER) - Users Mailing List
>>>> sr-users at lists.kamailio.org
>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
>>
>> --
>> Andy Chen
>> Sr. Telephony Lead Engineer
>> 415 516 5535 (M)
>> achen@ <achen at thinkingphones.com>fuze.com
>>
>>
>
> --
> Andy Chen
> Sr. Telephony Lead Engineer
> 415 516 5535 (M)
> achen@ <achen at thinkingphones.com>fuze.com
>
>
> *Confidentiality Notice: The information contained in this e-mail and any
> attachments may be confidential. If you are not an intended recipient, you
> are hereby notified that any dissemination, distribution or copying of this
> e-mail is strictly prohibited. If you have received this e-mail in error,
> please notify the sender and permanently delete the e-mail and any
> attachments immediately. You should not retain, copy or use this e-mail or
> any attachment for any purpose, nor disclose all or any part of the
> contents to any other person. Thank you.*
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-- 
Regards,

David Villasmil
email: david.villasmil.work at gmail.com
phone: +34669448337
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210316/42b87369/attachment.htm>


More information about the sr-users mailing list