Interface asterisk thru external xml based api (help)

hi all,

good morning to everyone. we have a running asterisk box in my home. i need a small modification to do it with for testing purpose. my requirement is i neet to access the asterisk box thru a xml api an dial a number and play a recording and when the other party press a number to select the choise i need to get that user input thru the api.

i dont need the whole solution. but cant thing whr to start. if u know any good resource that can help me please share with me. any hint will be appericiate.

thx lot. and happy new year.

no one have an idea ?

Can you elaborate on what you mean by “xml API”?

I was in a similar situation and needed to expose a small C# interface to Asterisk. I simply wrote a small wrapper for the Asterisk Manager Interface (AMI), and code on top of that. You could conceivably write your own wrapper (in your language of choice) that would parse out the XML and feed it into Asterisk in the way that AMI likes. I use AMI to transfer, originate, hangup, conference, etc etc.

Another note is that you mention you want to take some action based upon the user’s input (via numeric buttons on their phone I presume). I’m new to Asterisk but whenever I need to do this I have to update a context/extension block in the dialplan (extensions.conf).

I found the question confusing too. In particular, the reference to XML looks like either a political constraint that ought to be challenged with the specifier, or an an indication that this is a homework exercise. In my view, XML is seriously overused, at the expense of easy ot understand interfaces, because it is somehow fashionable.

Hi all,

First of all i need to thank you all for the replies.

I have successfully connected to my asterisk box thru AMI interface and able to generate a call. Then i played a recording. After the recoding called part should enter a DTMF tone. Now the issue is i need to get that user DTMF input thru my connected AMI interface and i need to pass that value to my external program.

Any clue ?

Capturing DTMF is better done in the dialplan. You can then generate a custom event with the result, or simply set a channel variable.

Hi,

I used the below dial plan to do a test to detect the caller press DTMF tomes.

exten => 5566,n,Read(NUMBER,4,3)
exten => 5566,n,SayNumber(${NUMBER})
exten => 5566,n,Playback(hello-world)
exten => 5566,n,Goto(1)

But when i dial the number 5566 it answer the call and wait until user input data. But it dosen’t detect any input from the user.
Hear is the asterisk debug details.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [5566@from-internal:1] Playback(“SIP/100-00000000”, “hello-world”) in new stack
– <SIP/100-00000000> Playing ‘hello-world.ulaw’ (language ‘en’)
– Executing [5566@from-internal:2] Read(“SIP/100-00000000”, “NUMBER,4,3”) in new stack
– Accepting a maximum of 4 digits.
– User entered nothing.
– Executing [5566@from-internal:3] SayNumber(“SIP/100-00000000”, “”) in new stack
== Spawn extension (from-internal, 5566, 3) exited non-zero on ‘SIP/100-00000000’
– Executing [h@from-internal:1] Macro(“SIP/100-00000000”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/100-00000000”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/100-00000000”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/100-00000000”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/100-00000000”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/100-00000000’ in macro ‘hangupcall’
== Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/100-00000000’

Any one have a clue. Im using DTMF in band signaling on my sip configuration file.

DTMF signalling methods mismatch. I’m assuming the timeout has been specified correctly.

Hear is my sip configuration.

[100]
deny=0.0.0.0/0.0.0.0
secret=
dtmfmode=inband
canreinvite=no
context=from-internal
host=dynamic
type=friend
nat=yes
port=5060
qualify=yes
callgroup=
pickupgroup=
dial=SIP/100
accountcode=
mailbox=100@device
permit=0.0.0.0/0.0.0.0
callerid=device <100>
call-limit=50
relaxdtmf=yes

i use dtmf mode as dtmfmode=inband. isn’t it incorrect ?

Normally it wait around 6sec. so i think it shouldn’t be a issue.

inband is rather unusual and the only common codecs with which it will work are the G.711 ones. In any case, it needs to match the setting at the other end.