Skip to content
Snippets Groups Projects
Commit 033fe283 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'sip_dev' into stable

parents 10c79d3f c3c978d5
No related branches found
No related tags found
No related merge requests found
...@@ -198,7 +198,8 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) ...@@ -198,7 +198,8 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
{ {
SIPCall* call = new SIPCall(id, Call::Outgoing); SIPCall* call = new SIPCall(id, Call::Outgoing);
if (call) { if (call) {
call->setPeerNumber(toUrl); //call->setPeerNumber(toUrl);
call->setPeerNumber(getSipTo(toUrl));
_debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data()); _debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data());
// we have to add the codec before using it in SIPOutgoingInvite... // we have to add the codec before using it in SIPOutgoingInvite...
call->setCodecMap(Manager::instance().getCodecDescriptorMap()); call->setCodecMap(Manager::instance().getCodecDescriptorMap());
...@@ -363,7 +364,15 @@ SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code UNUSED) ...@@ -363,7 +364,15 @@ SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code UNUSED)
SIPCall* call = getSIPCall(id); SIPCall* call = getSIPCall(id);
if (call==0) { _debug("Call doesn't exist\n"); return false; } if (call==0) { _debug("Call doesn't exist\n"); return false; }
Manager::instance().getUserAgent()->carryingDTMFdigits(call); int duration = Manager::instance().getConfigInt(SIGNALISATION, PULSE_LENGTH);
const int body_len = 1000;
char *dtmf_body = new char[body_len];
snprintf(dtmf_body, body_len - 1, "Signal=%c\r\nDuration=%d\r\n", code, duration);
return Manager::instance().getUserAgent()->carryingDTMFdigits(call, dtmf_body);
//int duration = Manager::instance().getConfigInt(SIGNALISATION, PULSE_LENGTH); //int duration = Manager::instance().getConfigInt(SIGNALISATION, PULSE_LENGTH);
// TODO Add DTMF with pjsip - INFO method // TODO Add DTMF with pjsip - INFO method
......
...@@ -1189,9 +1189,50 @@ bool UserAgent::refuse(SIPCall* call) ...@@ -1189,9 +1189,50 @@ bool UserAgent::refuse(SIPCall* call)
return true; return true;
} }
bool UserAgent::carryingDTMFdigits(SIPCall* call)
bool UserAgent::carryingDTMFdigits(SIPCall* call, char *msgBody)
{ {
pj_status_t status;
pjsip_tx_data *tdata;
pj_str_t methodName, content;
pjsip_method method;
pjsip_media_type ctype;
pj_strdup2(_pool, &methodName, "INFO");
pjsip_method_init_np(&method, &methodName);
/* Create request message. */
status = pjsip_dlg_create_request( call->getInvSession()->dlg, &method,
-1, &tdata);
if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to create INFO request -- %d\n", status);
return false;
}
/* Get MIME type */
pj_strdup2(_pool, &ctype.type, "application");
pj_strdup2(_pool, &ctype.subtype, "dtmf-relay");
/* Create "application/dtmf-relay" message body. */
pj_strdup2(_pool, &content, msgBody);
tdata->msg->body = pjsip_msg_body_create( tdata->pool, &ctype.type,
&ctype.subtype, &content);
if (tdata->msg->body == NULL) {
_debug("UserAgent: Unable to create msg body!\n");
pjsip_tx_data_dec_ref(tdata);
return false;
}
/* Send the request. */
status = pjsip_dlg_send_request( call->getInvSession()->dlg, tdata,
_mod.id, NULL);
if (status != PJ_SUCCESS) {
_debug("UserAgent: Unable to send MESSAGE request -- %d\n", status);
return false;
}
return true; return true;
} }
bool UserAgent::transfer(SIPCall *call, const std::string& to) bool UserAgent::transfer(SIPCall *call, const std::string& to)
......
...@@ -135,7 +135,7 @@ public: ...@@ -135,7 +135,7 @@ public:
bool makeOutgoingCall(const std::string& to, SIPCall* call, const AccountID& id); bool makeOutgoingCall(const std::string& to, SIPCall* call, const AccountID& id);
bool carryingDTMFdigits(SIPCall* call); bool carryingDTMFdigits(SIPCall* call, char *msgBody);
pj_pool_t *getAppPool() {return _pool;} pj_pool_t *getAppPool() {return _pool;}
static pj_bool_t mod_on_rx_request(pjsip_rx_data *rdata); static pj_bool_t mod_on_rx_request(pjsip_rx_data *rdata);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment