Skip to content

Instantly share code, notes, and snippets.

@jugaso
Last active January 4, 2018 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugaso/58d76fade445521d7fc15b9c82ee7a50 to your computer and use it in GitHub Desktop.
Save jugaso/58d76fade445521d7fc15b9c82ee7a50 to your computer and use it in GitHub Desktop.
How hability message chat on asterisk
;Acrescentar as linhas abaixo no arquivo extensions.conf
;Referenciar no arquivo SIP.conf este MENSAGEIRO
[MENSAGEIRO]
exten => _.,1,NoOp(SMS receiving dialplan invoked)
exten => _.,n,NoOp(To ${MESSAGE(to)})
exten => _.,n,NoOp(From ${MESSAGE(from)})
exten => _.,n,NoOp(Body ${MESSAGE(body)})
;exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,ExecIf($["${ACTUALTO}" != "sip:${EXTEN}"]?Set(ACTUALTO=sip:${EXTEN}))
exten => _.,n,MessageSend(${ACTUALTO},${MESSAGE(from)})
exten => _.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS})
exten => _.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg)
exten => _.,n,Hangup()
;; Handle failed messaging
exten => _.,n(sendfailedmsg),NoOp(Sending error to user)
exten => _.,n,Set(SRC=${MESSAGE(from)})
exten => _.,n,Set(DST=${MESSAGE(to)})
exten => _.,n,Set(MSG=${MESSAGE(body)})
exten => _.,n,Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] Sua mensagem para ${EXTEN} falhou. Destinatário não está on-line")
exten => _.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)})
exten => _.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)})
exten => _.,n,MessageSend(${ACTUALFROM},ServiceCenter)
;exten => _.,n,GotoIf($["${INQUEUE}" != "1"]?startq)
exten => _.,n,Hangup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment