I have some troublesome numbers that I would like to capture the SIP dialogue when I am calling them. When I am about to dial the number, is there any way to turn on SIP debugging in the dial plan before I make the call? (and turn it off after the call is completed?) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170217/143f3d28/attachment.html>
Why not capture the packets with something like tcpdump and run it through Wireshark? Tim On 2/17/17 2:43 PM, Derek Andrew wrote:> I have some troublesome numbers that I would like to capture the SIP > dialogue when I am calling them. When I am about to dial the number, is > there any way to turn on SIP debugging in the dial plan before I make > the call? (and turn it off after the call is completed?) > > > > >
Victor Villarreal
2017-Feb-17 23:09 UTC
[asterisk-users] Turn on SIP debugging from DialPlan
Hi Derek, SIP debug can be enabled via Asterisk CLI (console) with the command: asterisk> sip set debug on If you know via what trunk your call goes, you can use the following command instead: asterisk> sip set debug ip xxx.xxx.xxx.xxx Where the xxx is the IP of your trunk (voip to pstn provider). Affter you make all your test, simply issue: asterisk> sip set debug off And all the SIP conversation are saved in your full log file. More info here: https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information If what you want is test your dialplan, simply use the command: asterisk> dialplan show xxx at your_context Where xxx is the number you want to dial, from the context asigned to your extension. Cheers El 17/2/2017 19:44, "Derek Andrew" <Derek.Andrew at usask.ca> escribi?:> I have some troublesome numbers that I would like to capture the SIP > dialogue when I am calling them. When I am about to dial the number, is > there any way to turn on SIP debugging in the dial plan before I make the > call? (and turn it off after the call is completed?) > > > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170217/39414784/attachment.html>
Rafael dos Santos Saraiva
2017-Feb-17 23:26 UTC
[asterisk-users] Turn on SIP debugging from DialPlan
Hi
I don't know if works, but you can try this:
System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060
or udp portrange 10000-20000 &);
Wait(1);
Dial(SIP/${EXTEN});
System(pkill tcpdump);
Hangup;
Or whitout RTP:
System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060
&);
Wait(1);
Dial(SIP/${EXTEN});
System(pkill tcpdump);
Hangup;
Probably the last messages of SIP will be lost, BYE for example.
2017-02-17 20:43 GMT-02:00 Derek Andrew <Derek.Andrew at usask.ca>:
> I have some troublesome numbers that I would like to capture the SIP
> dialogue when I am calling them. When I am about to dial the number, is
> there any way to turn on SIP debugging in the dial plan before I make the
> call? (and turn it off after the call is completed?)
>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.
> org/
>
> New to Asterisk? Start here:
> https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Att,
Rafael Saraiva
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20170217/2a9afd00/attachment.html>
On Fri, 17 Feb 2017, Derek Andrew wrote:> I have some troublesome numbers that I would like to capture the SIP > dialogue when I am calling them. When I am about to dial the number, is > there any way to turn on SIP debugging in the dial plan before I make > the call? (and turn it off after the call is completed?)You could use the system() application as suggested before. You could also just start a console packet logger and just leave it running: sudo ngrep -O ngrep.pcap -W byline -d any <your-ani> port 5060 This will only capture packets containing your ANI which includes INVITE, Trying, OK, ACK, and BYE -- basically, the entire SIP dialog for the call. This will only take about 4kB per call, so you can log over 250 calls per mega-byte so I'm guessing that should be possible. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST https://www.linkedin.com/in/steve-edwards-4244281
Hi,
If you are ok with starting debug via external system call, why not to use
something like this (I used to use something similar, it worked):
exten => _XXX,1,System(/usr/sbin/asterisk -rx ?sip set debug peer PEER?)
same => n,Set(debug_on=1)
same => n,Dial(SIP/PEER/${EXTEN})
exten => h,1,GotoIf($[${debug_on} == 1]?undebug)
same => n,Hangup
same => n(undebug),System(( sleep 3 \; /usr/sbin/asterisk -rx 'sip set
debug off' ) &)
same => n,Set(debug_on=0)
same => n,Hangup
I don?t know your setup, your dialplan logic, but I?m sure you can adapt it to
your needs.
I.
> On 18 Feb 2017, at 00:26, Rafael dos Santos Saraiva <rafaelsnsa at
gmail.com> wrote:
>
> Hi
>
> I don't know if works, but you can try this:
>
> System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060
or udp portrange 10000-20000 &);
> Wait(1);
> Dial(SIP/${EXTEN});
> System(pkill tcpdump);
> Hangup;
>
> Or whitout RTP:
>
> System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060
&);
> Wait(1);
> Dial(SIP/${EXTEN});
> System(pkill tcpdump);
> Hangup;
>
> Probably the last messages of SIP will be lost, BYE for example.
>
>
>
>
>
> 2017-02-17 20:43 GMT-02:00 Derek Andrew <Derek.Andrew at usask.ca
<mailto:Derek.Andrew at usask.ca>>:
> I have some troublesome numbers that I would like to capture the SIP
dialogue when I am calling them. When I am about to dial the number, is there
any way to turn on SIP debugging in the dial plan before I make the call? (and
turn it off after the call is completed?)
>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com
<http://www.api-digital.com/> --
>
> Check out the new Asterisk community forum at:
https://community.asterisk.org/ <https://community.asterisk.org/>
>
> New to Asterisk? Start here:
> https://wiki.asterisk.org/wiki/display/AST/Getting+Started
<https://wiki.asterisk.org/wiki/display/AST/Getting+Started>
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
<http://lists.digium.com/mailman/listinfo/asterisk-users>
>
>
>
> --
> Att,
> Rafael Saraiva
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
https://community.asterisk.org/
>
> New to Asterisk? Start here:
> https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20170227/6e9f263d/attachment.html>
Perfect, exactly what I needed. Thanks. On Mon, Feb 27, 2017 at 6:32 AM, Igor Zamocky <igor at zamocky.sk> wrote:> Hi, > > If you are ok with starting debug via external system call, why not to use > something like this (I used to use something similar, it worked): > > exten =>* _XXX*,1,System(/usr/sbin/asterisk -rx ?sip set debug peer *PEER* > ?) > same => n,Set(debug_on=1) > same => n,Dial(SIP/*PEER*/${EXTEN}) > > exten => *h*,1,GotoIf($[${debug_on} == 1]?undebug) > same => n,Hangup > same => n(undebug),System(( sleep 3 \; /usr/sbin/asterisk -rx 'sip set > debug off' ) &) > same => n,Set(debug_on=0) > same => n,Hangup > > I don?t know your setup, your dialplan logic, but I?m sure you can adapt > it to your needs. > > I. > > On 18 Feb 2017, at 00:26, Rafael dos Santos Saraiva <rafaelsnsa at gmail.com> > wrote: > > Hi > > I don't know if works, but you can try this: > > System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060 > or udp portrange 10000-20000 &); > Wait(1); > Dial(SIP/${EXTEN}); > System(pkill tcpdump); > Hangup; > > Or whitout RTP: > > System(tcpdump -nq -s 0 -i eth0 -w /tmp/sip.pcap port 5060 > &); > Wait(1); > Dial(SIP/${EXTEN}); > System(pkill tcpdump); > Hangup; > > Probably the last messages of SIP will be lost, BYE for example. > > > > > > 2017-02-17 20:43 GMT-02:00 Derek Andrew <Derek.Andrew at usask.ca>: > >> I have some troublesome numbers that I would like to capture the SIP >> dialogue when I am calling them. When I am about to dial the number, is >> there any way to turn on SIP debugging in the dial plan before I make the >> call? (and turn it off after the call is completed?) >> >> >> >> >> -- >> _____________________________________________________________________ >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> >> Check out the new Asterisk community forum at: >> https://community.asterisk.org/ >> >> New to Asterisk? Start here: >> https://wiki.asterisk.org/wiki/display/AST/Getting+Started >> >> asterisk-users mailing list >> To UNSUBSCRIBE or update options visit: >> http://lists.digium.com/mailman/listinfo/asterisk-users >> > > > > -- > Att, > Rafael Saraiva > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > >-- Copyright 2017 Derek Andrew (excluding quotations) +1 306 966 4808 Communication and Network Services Information and Communications Technology Infrastructure Services *University of Saskatchewan*Peterson 120; 54 Innovation Boulevard Saskatoon,Saskatchewan,Canada. S7N 2V3 Timezone GMT-6 Typed but not read. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170227/21b1af65/attachment.html>