Arslan Mehboob
Arslan Mehboob

Reputation: 1020

Send Sip Message through fastagi asterisk

I am able to relay messages using dialplan. This command sends the message but I cant seem to run it using fastagi(java)

DialPlan

exten => _X.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})

FastAgi

public void service(AgiRequest ar, AgiChannel ac) throws AgiException {
    System.out.println(ac.getFullVariable("${MESSAGE(body)}"));
    System.out.println(ac.getFullVariable("${MESSAGE(to)}"));
    System.out.println(ac.getFullVariable("${MESSAGE(from)}"));
    System.out.println(ac.getFullVariable("${CUT(MESSAGE(to),@,1)}"));
    //Correct values are show from above printlns
    ac.exec("MessageSend(${CUT(MESSAGE(to),@,1)},${MESSAGE(from)})");
}

Last line results in a warning in /var/asterisk/messages

WARNING[2287][C-00000000] res_agi.c: Could not find application (MessageSend(${CUT(MESSAGE(to),@,1)})

Upvotes: 0

Views: 1565

Answers (2)

arheops
arheops

Reputation: 15259

So far message is expected. There are no AGI command like that

Check

asterisk -rx "core show application like message"

if found, try do

 ac.exec("MessageSend \"${CUT(MESSAGE(to),@,1)},${MESSAGE(from)})\"");

For more info check specification

http://www.voip-info.org/wiki/view/exec

Upvotes: 0

Arslan Mehboob
Arslan Mehboob

Reputation: 1020

Figured it out, this is how it is done in fastagi

ac.exec("MessageSend","sip:100,<sip:[email protected]:5080>");

Documentation for MessageSend https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_MessageSend

Upvotes: 0

Related Questions