[asterisk-bugs] [JIRA] (ASTERISK-28715) Setting Content-Type header in MessageSend application by using PJSIP

Michael (JIRA) noreply at issues.asterisk.org
Sat Jan 25 15:39:25 CST 2020


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=249551#comment-249551 ] 

Michael commented on ASTERISK-28715:
------------------------------------

Dialplan is like that:
[internalmsg]
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,NoOp(Content-Type ${MESSAGE_DATA(Content-Type)})
;exten => _.,n,AGI(chatplan.php,${MESSAGE(from)})
exten => _.,n,Set(ACTUALTO=${CUT(MESSAGE(to),@,1)})
exten => _.,n,ExecIf($["${ACTUALTO}" != "pjsip:${EXTEN}"]?Set(ACTUALTO=pjsip:${EXTEN}))
;exten => _.,n,Set(MESSAGE_DATA(Content-Type)=${MESSAGE_DATA(Content-Type)})
exten => _.,n,Set(MESSAGE(custom_data)=mark_all_outbound)
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)}] Your message to ${EXTEN} has failed. Sending when available")
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()
;
exten => _.,n(startq),NoOp(Queueing messaging for offline)
exten => _.,n,Set(MSGTIME=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
exten => _.,n,SYSTEM(/var/lib/asterisk/agi-bin/astqueue.sh –SRC ‘${SRC}’ –DST ‘${DST}’ –MSG ‘${MSG}’)
exten => _.,n,Hangup()[app-fakeanswer]
exten => _.,1,NoCDR
exten => _.,n,Set(DESTDEV=${EXTEN})
exten => _.,n,Set(THISDEVSTATE=${DEVICE_STATE(SIP/${DESTDEV})})
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNAVAILABLE"]?hang)
exten => _.,n,GotoIf($["${THISDEVSTATE}" = "UNKNOWN"]?hang)
exten => _.,n,Answer
exten => _.,n,Hangup()
exten => _.,n(hang),Hangup()


> Setting Content-Type header in MessageSend application by using PJSIP
> ---------------------------------------------------------------------
>
>                 Key: ASTERISK-28715
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28715
>             Project: Asterisk
>          Issue Type: New Feature
>      Security Level: None
>          Components: Resources/res_pjsip_messaging
>    Affects Versions: 16.6.2
>            Reporter: Michael
>
> Following scenario: I'm using Acrobit Groundwire on 2 iPhones to do SIMPLE SIP messaging over my Asterisk instance. The problem is I cannot use the composing notification as well as the delivery notification and an additional media service for exchanging photos because the use Content-Type header like "application/*".
> Problem:
> Asterisk normally allows only "text/plain" on SIMPLE SIP messages when using not in an dialog. I disabled this check and allow also the application/* content type.
> Now Asterisk accepts the content type but always adding a secondary header with "text/plain" even a Content-Type is already present in the SIP message. This breaks the correct handling of the message by the client because it handles the message wrong because of the "text/plain" header.
> Implementing this in res_pjsip_messaging.c results in a massive segfault where I don't know why (documentation is to rare to find out why).
> Thats why I'm requesting to set the content-type from the dialplan. Perhaps somebody else is more a C developer than me (coming from the JAVA-World but C knowledge).



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list