TUTORIAL asterisk 11: XMPP Notification Using Asterisk 11 and Openfire

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
Custom Configure XMPP Connected, But can Send notifications:
XenServer-PBX*CLI> xmpp show connections
Jabber Users and their status:
[asterisk1] [email protected] - Connected
;# // BEGIN XMPP Alert for Incoming Calls
exten => 701,1,JabberSend(asterisk1,[email protected], Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => 701,n,MessageSend(xmpp:asterisk1,[email protected], Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
;# // END XMPP Alert for Incoming Calls
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
i'm looking for the correct update string syntax, to properly make this work, as i can't find any definitive information using the new messagesend and xmpp.
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
if i'm correct from the reading i've done, the command jabbersend, no long works on asterisk 11
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
lqqqqqqqqqqqqqqqqqqqqqqqqSYSTEM INFORMATIONqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Asterisk = ONLINE | Dahdi = ONLINE | MySQL = ONLINE x
x SSH = ONLINE | Apache = ONLINE | Iptables = ONLINE x
x Fail2ban = ONLINE | Internet = ONLINE | Ip6Tables = ONLINE x
x Disk Free = ADEQUATE| Mem Free = ADEQUATE| NTPD = ONLINE x
x SendMail = ONLINE | Samba = OFFLINE | Webmin = ONLINE x
x Ethernet0 = ONLINE | Ethernet1 = ONLINE | Wlan0 = N/A x
x x
x PIAF Installed Version = 3.0.6.5 under *XEN* x
x FreePBX Version = 2.11.0.37 x
x Running Asterisk Version = 11.8.1 x
x Asterisk Source Version = 11.8.1 x
x Dahdi Source Version = 2.9.0 x
x Libpri Source Version = 1.4.14 x
x IP Address = 192.168.0.212 on eth0 x
x Operating System = CentOS release 6.5 (Final) >< x
x Kernel Version = 2.6.32-431.11.2.el6.i686 - 32 Bit x
x Incredible Version = 11.9 x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
i'm looking for the correct update string syntax, to properly make this work, as i can't find any definitive information using the new messagesend and xmpp.


Sometimes the documentation is hard to find but the CLI help is very good. Use it when you want command syntax.

Code:
*CLI> core show application messagesend
 
  -= Info about application 'MessageSend' =-
 
[Synopsis]
Send a text message.
 
[Description]
Send a text message.  The body of the message that will be sent is what is
currently set to 'MESSAGE(body)'.  The technology chosen for sending the
message is determined based on a prefix to the 'to' parameter.
This application sets the following channel variables:
${MESSAGE_SEND_STATUS}: This is the message delivery status returned by this
application.
    INVALID_PROTOCOL: No handler for the technology part of the URI was
    found.
    INVALID_URI: The protocol handler reported that the URI was not valid.
    SUCCESS: Successfully passed on to the protocol handler, but delivery
    has not necessarily been guaranteed.
    FAILURE: The protocol handler reported that it was unabled to deliver
    the message for some reason.
 
[Syntax]
MessageSend(to[,from])
 
[Arguments]
to
    A To URI for the message.
        Technology: SIP
        Specifying a prefix of 'sip:' will send the message as a
        SIP MESSAGE request.
        Technology: XMPP
        Specifying a prefix of 'xmpp:' will send the message as an
        XMPP chat message.
from
    A From URI for the message if needed for the message technology being
    used to send this message.
        Technology: SIP
        The 'from' parameter can be a configured peer name or in
        the form of "display-name" <URI>.
        Technology: XMPP
        Specifying a prefix of 'xmpp:' will specify the account
        defined in 'xmpp.conf' to send the message from. Note that this field
        is required for XMPP messages.
 
[See Also]
Not available

According to this, rather than putting the message in the MessageSend command, you first need to put the message into the variable MESSAGE(body) and then call MessageSend.
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
Info on MESSAGE:

Code:
*CLI> core show function MESSAGE
 
  -= Info about function 'MESSAGE' =-
 
[Synopsis]
Create a message or read fields from a message.
 
[Description]
This function will read from or write a value to a text message. It is used
both to read the data out of an incoming message, as well as modify or create
a message that will be sent outbound.
 
[Syntax]
MESSAGE(argument)
 
[Arguments]
argument
    Field of the message to get or set.
    to - Read-only.  The destination of the message.  When processing
    an incoming message, this will be set to the destination listed as the
    recipient of the message that was received by Asterisk.
    from - Read-only.  The source of the message.  When processing an
    incoming message, this will be set to the source of the message.
    custom_data - Write-only.  Mark or unmark all message headers for
    an outgoing message.  The following values can be set:
        mark_all_outbound - Mark all headers for an outgoing message.
        clear_all_outbound - Unmark all headers for an outgoing
        message.
    body - Read/Write.  The message body.  When processing an incoming
    message, this includes the body of the message that Asterisk received.
    When MessageSend() is executed, the contents of this field are used as
    the body of the outgoing message.  The body will always be UTF-8.
 
[See Also]
MessageSend()
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
Tying it together will look something like this (not tested, debugging is up to you!)

Code:
exten => 701,n,Set(MESSAGE(body)=Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)}))
exten => 701,n,MessageSend(xmpp:[email protected],xmpp:asterisk1)
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
-- Accepting AUTHENTICATED call from xxx.xxx.xxx.xxx:
-- > requested format = ulaw,
-- > requested prefs = (ulaw|alaw|gsm),
-- > actual format = ulaw,
-- > host prefs = (ulaw|alaw|gsm),
-- > priority = mine
-- Executing [701@from-internal:1] GotoIf("IAX2/main1iax-6627", "0?ext-local,701,1") in new stack
-- Executing [701@from-internal:2] Macro("IAX2/main1iax-6627", "user-callerid,") in new stack
-- Executing [s@macro-user-callerid:1] Set("IAX2/main1iax-6627", "TOUCH_MONITOR=1402935049.38") in new stack
-- Executing [s@macro-user-callerid:2] Set("IAX2/main1iax-6627", "AMPUSER=2002") in new stack
-- Executing [s@macro-user-callerid:3] GotoIf("IAX2/main1iax-6627", "0?report") in new stack
-- Executing [s@macro-user-callerid:4] ExecIf("IAX2/main1iax-6627", "1?Set(REALCALLERIDNUM=2002)") in new stack
-- Executing [s@macro-user-callerid:5] Set("IAX2/main1iax-6627", "AMPUSER=") in new stack
-- Executing [s@macro-user-callerid:6] GotoIf("IAX2/main1iax-6627", "0?limit") in new stack
-- Executing [s@macro-user-callerid:7] Set("IAX2/main1iax-6627", "AMPUSERCIDNAME=") in new stack
-- Executing [s@macro-user-callerid:8] GotoIf("IAX2/main1iax-6627", "1?report") in new stack
-- Goto (macro-user-callerid,s,15)
-- Executing [s@macro-user-callerid:15] GotoIf("IAX2/main1iax-6627", "0?continue") in new stack
-- Executing [s@macro-user-callerid:16] Set("IAX2/main1iax-6627", "__TTL=64") in new stack
-- Executing [s@macro-user-callerid:17] GotoIf("IAX2/main1iax-6627", "1?continue") in new stack
-- Goto (macro-user-callerid,s,28)
-- Executing [s@macro-user-callerid:28] Set("IAX2/main1iax-6627", "CALLERID(number)=2002") in new stack
-- Executing [s@macro-user-callerid:29] Set("IAX2/main1iax-6627", "CALLERID(name)=IAX-Mobile-Personal") in new stack
-- Executing [s@macro-user-callerid:30] Set("IAX2/main1iax-6627", "CDR(cnum)=2002") in new stack
-- Executing [s@macro-user-callerid:31] Set("IAX2/main1iax-6627", "CDR(cnam)=IAX-Mobile-Personal") in new stack
-- Executing [s@macro-user-callerid:32] Set("IAX2/main1iax-6627", "CHANNEL(language)=en") in new stack
-- Executing [701@from-internal:3] Set("IAX2/main1iax-6627", "DIAL_OPTIONS=TtrI") in new stack
-- Executing [701@from-internal:4] Set("IAX2/main1iax-6627", "CONNECTEDLINE(num)=701") in new stack
-- Executing [701@from-internal:5] Gosub("IAX2/main1iax-6627", "sub-presencestate-display,s,1(701)") in new stack
[2014-06-16 11:10:49] WARNING[22138][C-0000001b]: func_presencestate.c:132 presence_read: PRESENCE_STATE unknown
-- Executing [s@sub-presencestate-display:1] Goto("IAX2/main1iax-6627", "state-,1") in new stack
-- Goto (sub-presencestate-display,state-,1)
-- Executing [state-@sub-presencestate-display:1] Set("IAX2/main1iax-6627", "PRESENCESTATE_DISPLAY=") in new stack
-- Executing [state-@sub-presencestate-display:2] Return("IAX2/main1iax-6627", "") in new stack
-- Executing [701@from-internal:6] Set("IAX2/main1iax-6627", "CONNECTEDLINE(name,i)=Personal-Line") in new stack
-- Executing [701@from-internal:7] Set("IAX2/main1iax-6627", "FM_DIALSTATUS=NOT_INUSE") in new stack
-- Executing [701@from-internal:8] Set("IAX2/main1iax-6627", "__EXTTOCALL=701") in new stack
-- Executing [701@from-internal:9] Set("IAX2/main1iax-6627", "__PICKUPMARK=701") in new stack
-- Executing [701@from-internal:10] Macro("IAX2/main1iax-6627", "blkvm-setifempty,") in new stack
-- Executing [s@macro-blkvm-setifempty:1] GotoIf("IAX2/main1iax-6627", "1?init") in new stack
-- Goto (macro-blkvm-setifempty,s,4)
-- Executing [s@macro-blkvm-setifempty:4] Set("IAX2/main1iax-6627", "__BLKVM_CHANNEL=IAX2/main1iax-6627") in new stack
-- Executing [s@macro-blkvm-setifempty:5] Set("IAX2/main1iax-6627", "SHARED(BLKVM,IAX2/main1iax-6627)=TRUE") in new stack
-- Executing [s@macro-blkvm-setifempty:6] Set("IAX2/main1iax-6627", "GOSUB_RETVAL=TRUE") in new stack
-- Executing [s@macro-blkvm-setifempty:7] MacroExit("IAX2/main1iax-6627", "") in new stack
-- Executing [701@from-internal:11] GotoIf("IAX2/main1iax-6627", "1?skipov") in new stack
-- Goto (from-internal,701,14)
[2014-06-16 11:10:49] WARNING[22138][C-0000001b]: pbx.c:4872 pbx_extension_helper: No application 'MESSAGE' for extension (from-internal, 701, 14)
== Spawn extension (from-internal, 701, 14) exited non-zero on 'IAX2/main1iax-6627'
-- Executing [h@from-internal:1] Hangup("IAX2/main1iax-6627", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'IAX2/main1iax-6627'
-- Hungup 'IAX2/main1iax-6627'
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,540
Reaction score
729
-- Goto (from-internal,701,14)
[2014-06-16 11:10:49] WARNING[22138][C-0000001b]: pbx.c:4872 pbx_extension_helper: No application 'MESSAGE' for extension (from-internal, 701, 14)


I forgot the Set(). I updated my previous post.
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
Awesome, this there a way to define every extension with out the long coding, something like a general code like xxx for a exten
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
Help Update On Using This resource depending On your current xmpp status:

;# // BEGIN XMPP Alert for Incoming Calls
;exten => 1003,1,JabberSend(openfire1,[email protected]-ip.org, Incoming Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => 1003,1,Set(JSTATUS=${JABBER_STATUS(openfire1,[email protected]-ip.org/Xen)})
exten => 1003,n,GotoIf($[0${JSTATUS} = 1]?available:unavailable)
exten => 1003,n,(available),JabberSend(xmpp:eek:penfire1,[email protected]-ip.org, Incoming Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => 1003,Hangup
exten => 1003,n,(unavailable),exten => 1003,n,JabberSend(xmpp:eek:penfire1,[email protected]-ip.org, Missed Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
;exten => 1003,n,MessageSend(xmpp:eek:penfire1,[email protected]-ip.org, Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
;# // END XMPP Alert for Incoming Call

-- Accepting AUTHENTICATED call from 66.87.79.192:8353:
-- > requested format = ulaw,
-- > requested prefs = (),
-- > actual format = ulaw,
-- > host prefs = (ulaw|alaw|gsm),
-- > priority = mine
-- Executing [1003@from-internal:1] Set("IAX2/801-4872", "JSTATUS=1") in new stack
-- Executing [1003@from-internal:2] GotoIf("IAX2/801-4872", "1?available:unavailable") in new stack
[2015-03-27 15:00:41] NOTICE[16150][C-00000016]: pbx.c:4911 pbx_extension_helper: No such label 'available' in extension '1003' in context 'from-internal'
[2015-03-27 15:00:41] WARNING[16150][C-00000016]: pbx.c:12202 pbx_parseable_goto: Priority 'available' must be a number > 0, or valid label
== Spawn extension (from-internal, 1003, 2) exited non-zero on 'IAX2/801-4872'
-- Executing [h@from-internal:1] Hangup("IAX2/801-4872", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'IAX2/801-4872'
-- Hungup 'IAX2/801-4872'
 

trupsalms

Member
Joined
May 13, 2011
Messages
337
Reaction score
6
Resolved Update, Does not use status offline or unavailable, but does work for idle, away etc.

;# // BEGIN XMPP Alert for Incoming Calls
;exten => _x103,1,JabberSend(openfire1,[email protected]-ip.org, Incoming Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => _x103,1,Set(JSTATUS=${JABBER_STATUS(openfire1,[email protected]-ip.org/Xen)})
exten => _x103,n,GotoIf($[0${JSTATUS} = 1]?available:unavailable)
;exten => _x103,n(available),JabberSend(xmpp:eek:penfire1,[email protected]-ip.org, Incoming Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => _x103,n(available),JabberSend(openfire1,[email protected]-ip.org, Incoming Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => _x103,n,wait
;exten => _x103,n(unavailable),JabberSend(xmpp:eek:penfire1,[email protected]-ip.org, Missed Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => _x103,n(unavailable),JabberSend(openfire1,[email protected]-ip.org, Missed Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})
exten => _x103,n,Hangup
;exten => _x103,n,MessageSend(xmpp:eek:penfire1,[email protected]-ip.org, Call from ${CALLERID(name)} at ${CALLERID(number)} received ${STRFTIME(${EPOCH},,%l:%M:%S %p %Z on %A %B %e)})

;# // END XMPP Alert for Incoming Calls
 

Members online

Forum statistics

Threads
25,801
Messages
167,717
Members
19,231
Latest member
manne
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top