PJSUA2 Android onCallTsxState

JS
Jonathan Simmonds
Tue, Nov 13, 2018 9:46 AM

Hello,

I’m trying to use the onCallTsxState callback to retrieve a reason header for when a call is completed elsewhere (cause=26). When developing for iOS this was simple:

void on_call_tsx_state(pjsua_call_id call_id, pjsip_transaction *tsx, pjsip_event *e) {
if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) {
pjsip_rx_data *rdata = e->body.rx_msg.rdata;
NSString *messageBuffer = [NSString stringWithCString:rdata->msg_info.msg_buf encoding:NSUTF8StringEncoding];
// do something interesting with the message buffer
}
}

I have reproduced this in Android:

public void onCallTsxState(OnCallTsxStateParam prm) {
super.onCallTsxState(prm);

SipEventBody eventBody = prm.getE().getBody();
if (eventBody.getTsxState().getType().equals(pjsip_event_id_e.PJSIP_EVENT_RX_MSG)) {
SipRxData rdata = eventBody.getRxMsg().getRdata();
String messageBuffer = rdata.getWholeMsg();
// do something interesting with the message buffer
}
}

However, getWholeMsg() always returns an empty string, as do any other string returning methods for the SipRxData instance. Does anyone know why this is the case? Or, a better method for retrieving this reason header?

Thanks,

Jonathan

Hello, I’m trying to use the onCallTsxState callback to retrieve a reason header for when a call is completed elsewhere (cause=26). When developing for iOS this was simple: void on_call_tsx_state(pjsua_call_id call_id, pjsip_transaction *tsx, pjsip_event *e) { if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG) { pjsip_rx_data *rdata = e->body.rx_msg.rdata; NSString *messageBuffer = [NSString stringWithCString:rdata->msg_info.msg_buf encoding:NSUTF8StringEncoding]; // do something interesting with the message buffer } } I have reproduced this in Android: public void onCallTsxState(OnCallTsxStateParam prm) { super.onCallTsxState(prm); SipEventBody eventBody = prm.getE().getBody(); if (eventBody.getTsxState().getType().equals(pjsip_event_id_e.PJSIP_EVENT_RX_MSG)) { SipRxData rdata = eventBody.getRxMsg().getRdata(); String messageBuffer = rdata.getWholeMsg(); // do something interesting with the message buffer } } However, getWholeMsg() always returns an empty string, as do any other string returning methods for the SipRxData instance. Does anyone know why this is the case? Or, a better method for retrieving this reason header? Thanks, Jonathan