Q:Use phone card (Target et al) for outgoing PSTN calls


Q:How to utilize phone card for outgoing PSTN calls.
Not sure if this has been a topic… I could not find anything about it.

My goal is to transparently use a phone card for dialing long distance. Perhaps I am stating the obvious, I am talking phone cards as offered in the check-out line at Target and stores of that kind.
Configuration: This is for the US, I am running Asterisk 1.0.9.

The only way I could find anything in that direction was to use the D flag of Dial(). Excerpt from extensions.conf:

exten => _91XXXNXXXXXX,1,Dial(Zap/1/18001234567,D(198765431${EXTEN:1}))

Note: 1800-number (1234567) and PIN(9876543) modified.

Asterisk is dialing 18001234567 to reach the phone card company when a long distance no. is typed at the calling phone. So far so good.
198765431 and the number sans leading 9 are not sent via DTMF however. No luck. It seams as if DTMF numbers are not sent at all. Am I asking too much? I wonder if the D flag resolves $(EXTEN:1} at all. Is this the right approach? Upgrade to Asterisk 1.2 needed?


You should use the SendDTMF command for this. Something like:

exten => _91XXXNXXXXXX,1,Dial(Zap/1/18001234567)
exten => _91XXXNXXXXXX,2,Wait(2)
exten => _91XXXNXXXXXX,3,SendDTMF(198765431)
exten => _91XXXNXXXXXX,4,Wait(2)
exten => _91XXXNXXXXXX,5,SendDTMF({EXTEN:1})


Here’s how I got it to work:
zmanea, thank you, SendDTMF() was a valuable hint, even though I could not go this route. SendDTMF() does not work, because Dial() does not move to steps 2, 3 etc. as long as the call is established. I found flag D in Dial() the way to go. Even so your post was helpful, as my documentation for SendDTMF() shows how to enter pauses in an DTMF dial string though ‘w’, which indicates a 500-millisecond wait. Here’s the resulting line, not a beauty exactly:

exten => _91XXXNXXXXXX,1,Dial(Zap/1/18001234567,D(wwwwwwwwwwww1

This is for my Target/MCI Worldcom phone card. MCI Worlcom picks up, and I
wait four seconds then send 1 (select language)
wait two seconds then send PIN (9876543)
wait two seconds then send 1 (yes, I want to call, not load my account)
wait two seconds then dial target number.
I’m going to try and tune this a little, but I believe there’s not much room.