0

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)})

fortune
  • 3,361
  • 1
  • 20
  • 30
Arslan Mehboob
  • 1,012
  • 1
  • 9
  • 21

2 Answers2

0

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

ac.exec("MessageSend","sip:100,<sip:102@192.168.1.100:5080>");

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

Arslan Mehboob
  • 1,012
  • 1
  • 9
  • 21
0

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

arheops
  • 15,544
  • 1
  • 21
  • 27