Summary:ASTERISK-22777: pjsip messaging: Investigate in dialog message request test failures; determine correct behavior of in call messaging
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2013-10-27 18:00:45Date Closed:2013-10-30 12:54:50
Status:Closed/CompleteComponents:Resources/res_pjsip_messaging Tests/testsuite
Versions:12.0.0-beta1 Frequency of
Description:The PJSIP [message_in_dialog|https://bamboo.asterisk.org/bamboo/browse/AST-ATTSCD4-C632TE-83/test/case/1415465] test is failing on bamboo.

The test uses two SIPp scenarios. One creates a call and, upon reception of the 200 OK from Asterisk, sends a SIP MESSAGE request in dialog to Asterisk. The second SIPp scenario expects to receive a call, followed by a SIP MESSAGE request.

However, this doesn't seem to be what {{res_pjsip_messaging}} will do. Upon receiving a SIP MESSAGE request in dialog, it appears as if that module will construct an AST_FRAME_TEXT frame and enqueue that on the existing channel:

static int incoming_in_dialog_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
char buf[MAX_BODY_SIZE];
enum pjsip_status_code code;
struct ast_frame f;

pjsip_dialog *dlg = session->inv_session->dlg;
pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);


memset(&f, 0, sizeof(f));
f.frametype = AST_FRAME_TEXT;
f.subclass.integer = 0;
f.offset = 0;
f.data.ptr = buf;
f.datalen = strlen(buf) + 1;
ast_queue_frame(session->channel, &f);

send_response(rdata, PJSIP_SC_ACCEPTED, dlg, tsx);
return 0;

The problem is, PJSIP channels don't handle text frames. Even if they did, they wouldn't send the text message out as a SIP MESSAGE request - I'm assuming they'd pass that text message down to the RTP engine.

This issue is to figure out what the correct behavior of in dialog MESSAGE request should be, and to implement it in PJSIP. Correspondingly, the test should be updated to reflect the expected behavior.

(And if the reading of the code is wrong, the test is still failing sporadically without indicating much in the Asterisk logs. We should have some DEBUG level message at least that indicate what we did with the MESSAGE request)