Debugging Dialplan

Home » Asterisk Users » Debugging Dialplan
Asterisk Users 7 Comments

Hi list!

Since I think, I have a problem in my dialplan, how can I debug it?
It would be very useful a command in Asterisk CLI to ask Asterisk what it would do if the number X call the number Y. Something like “exim -bt”, if someone here know the SMTP-daemon Exim…

Is there such an option in Asterisk?

Thanks Luca Bertoncello
(lucabert@lucabert.de)

7 thoughts on - Debugging Dialplan

  • Zitat von Sebastian Kemper :

    Hello Sebastian

    Thanks a lot!
    Is there an option to check all?
    What I mean is: if someone call a number, Asterisk go through the
    dialplan and try to send the call to the extension. Now, I want to “simulate” the same. I know the source and the destination number. I’m not sure how can I
    know the context. How can I say Asterisk “what do you want to do with the call from X to Y”?

    Thanks Luca Bertoncello
    (lucabert@lucabert.de)

  • Yes, it is called “core set verbose 42”, the other options is “core set debug 42”. Enjoy the show!

    Once you are more familiar with *, you might want to have a look what you can do with logger.conf.

    jg

  • Zitat von jg :

    OK, thanks, but with this option I can just debug what happens if I
    call an extension right now… I’d like to have a command to ask Asterisk how it will handle a call…

    Maybe later…

    Thanks Luca Bertoncello
    (lucabert@lucabert.de)

  • Hi Luca,

    It’s not the A number you have to look at if you want to know how a call comes into the dialplan and then goes out again. You want do know in which context a call arrives. That depends on things like the IP address (peer), username/password (friend) or other things.

    I suggest to read up on that using the Internet (there are e.g. wiki articles about this subject) or a book (e.g. “Definitive Guide on Asterisk”).

    Regards, Sebastian

    Am 29. Mai 2015 09:42:55 MESZ, schrieb Luca Bertoncello :

  • Please don’t top post.

    I know you can specify a level to the verbose application, but is anything in Asterisk ‘hard-coded’ for debug or verbose above 6? (And yes, I know the significance of ’42’ in pop culture.)

    You can use the ‘dialplan’ command to get a clue. For example, I have this context in a dialplan:

    ; meetme-star-menu
    ; 1 say private meeting number
    ; 3 enter private room
    ; 456 go to the admin menu
    [meetme-star-menu](h,s)
    exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}!${ANI}])
    exten = i,n, goto(enter-room,s,1)
    exten = t,1, verbose(1,[${EXTEN}@${CONTEXT}!${ANI}])
    exten = t,n, goto(enter-room,s,1)
    ; say private meeting number
    exten = 1,1, verbose(1,[${EXTEN}@${CONTEXT}!${ANI}])
    exten = 1,n, saydigits(${PRIVATE-CODE})
    exten = 1,n, goto(enter-room,s,1)
    ; enter private room
    exten = 3,1, verbose(1,[${EXTEN}@${CONTEXT}!${ANI}])
    exten = 3,n, goto(private-lounge,s,1)
    ; admin functions
    exten = _[456],1, verbose(1,[${EXTEN}@${CONTEXT}!${ANI}])
    exten = _[456],n, gotoif($[“TRUE” = “${ADMIN}”] ?meetme-star-admin-menu,${EXTEN},1)
    exten = _[456],n, goto(enter-room,s,1)

    I can ask Asterisk what happens if the caller enters ‘5’ like:

    joy10:joy:08:50:18> dialplan show 5@meetme-star-menu
    [ Context ‘meetme-star-menu’ created by ‘pbx_config’ ]
    ‘_[456]’ => 1. verbose(1,[${EXTEN}@${CONTEXT}!${ANI}]) [pbx_config]
    2. gotoif($[“TRUE” = “${ADMIN}”] ?meetme-star-admin-menu,${EXTEN},1) [pbx_config]
    3. goto(enter-room,s,1) [pbx_config]

    If I ask what happens if a caller enters 7, I get:

    joy10:joy:08:51:42> dialplan show 7@meetme-star-menu There is no existence of 7@meetme-star-menu extension

    In which case, I could ask what Asterisk will do with an invalid extension:

    joy10:joy:08:52:19> dialplan show i@meetme-star-menu
    [ Context ‘meetme-star-menu’ created by ‘pbx_config’ ]
    ‘i’ => 1. verbose(1,[${EXTEN}@${CONTEXT}!${ANI}]) [pbx_config]
    2. goto(enter-room,s,1) [pbx_config]

    Note the format of my verbose() arguments. It makes it easy to
    ‘cut-n-paste’ in a ‘dialplan show’ command.