Single digit dial plan with asterisk and pap2 for a toddler

Hi Everyone,

I’m new to asterisk. I’m trying to create a phone for my toddler so he can dial a single number and hear a clip from paw patrol (or something similar).

I have asterisk (and my configuration) working with a softphone, but I’m having issues getting it working with the physical phone. I’m using a Linksys PAP2 with the cheapest old fashioned phone that I can.

The configuration was taken from Hello World - Asterisk Documentation. My configuration is:

pjsip.conf:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0

[6001]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
auth=6001
aors=6001

[6001]
type=auth
auth_type=userpass
password=unsecurepassword
username=6001

[6001]
type=aor
max_contacts=5

sip.conf:

[general]
context=default

[6001]
type=friend
context=from-internal
host=dynamic
secret=unsecurepassword
disallow=all
allow=ulaw

extensions.conf:

[from-internal]
exten = 100,1,Answer()
same = n,Wait(1)
same = n,Playback(hello-world)
same = n,Hangup()

In the PAP2 configuration, I set the dial plan to “x” (IP dialing disabled, emergency number blank).

When I dial “1”, I immediately get a busy tone. When I dial any number other than “1”, I get the error message:

[Dec 16 19:38:12] NOTICE[3291]: res_pjsip_session.c:4022 new_invite:  6001: Call (UDP:192.168.1.144:5060) to extension '2' rejected because extension not found in context 'from-internal'.

Because the softphone works, I suspect that the issue is somewhere in the PAP2. I know this isn’t a PAP2 forum, but this is the right audience.

Does anyone know what I need to do to get it working?

Thanks!

Your extension number is 100, but you are calling extension 2.

Also remove sip.conf, to avoid confusion as to which one gets port 5060.

It might be more interesting to delay before the answer, so that they hear ringback tone.

The hangup is redundant.

Sounds like fun.

Soon you can teach him to dial 32339 to call your mobile :slight_smile:

Much appreciated david! I was able to get a proof of concept working!

fun litte dialplan

exten => _[#*],1,Playback(digits/${EXTEN})
exten => _X!,1,Saydigits(${EXTEN})

Ohhh, can I guess what it’s doing? If you dial # or !, followed by any digits, they’ll be read back to you?

I don’t understand the _ prefix or X!. Could you point me towards some documentation?

I’m also thinking of making a dialplan where the phone doesn’t need to be hungup between playback. I haven’t looked into it yet.

Other fun things are definitely welcome :slight_smile:

the _X! is do a pattern match on any digits ! is one or more digits
https://docs.asterisk.org/Configuration/Dialplan/Pattern-Matching/?h=pattern

and to make more fun you can include some eastereggs like
looking at the letter next to each number 6=mno so m=6 o=6 m=6 mom=666 yes she is the devel :slight_smile:

exten => 666,1,Playback(mom)
exten => 323,1,Playback(dad)

Enter Pi and win pie!

! is zero or more digits with an aggressive termination of the match. Asterisk will not request more digits to see if a longer match is possible.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.