mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
add support for dtmfs in SIP INFO
This commit is contained in:
parent
5690d65d0b
commit
2062792139
2 changed files with 21 additions and 3 deletions
|
|
@ -687,10 +687,25 @@ SalMediaDescription * sal_call_get_final_media_description(SalOp *h){
|
|||
}
|
||||
return h->result;
|
||||
}
|
||||
|
||||
int sal_call_send_dtmf(SalOp *h, char dtmf){
|
||||
ms_fatal("sal_call_send_dtmf not implemented yet");
|
||||
return -1;
|
||||
if (h->dialog){
|
||||
belle_sip_request_t *req=belle_sip_dialog_create_request(h->dialog,"INFO");
|
||||
if (req){
|
||||
int bodylen;
|
||||
char dtmf_body[128]={0};
|
||||
|
||||
snprintf(dtmf_body, sizeof(dtmf_body)-1, "Signal=%c\r\nDuration=250\r\n", dtmf);
|
||||
bodylen=strlen(dtmf_body);
|
||||
belle_sip_message_set_body((belle_sip_message_t*)req,dtmf_body,bodylen);
|
||||
belle_sip_message_add_header((belle_sip_message_t*)req,(belle_sip_header_t*)belle_sip_header_content_length_create(bodylen));
|
||||
belle_sip_message_add_header((belle_sip_message_t*)req,(belle_sip_header_t*)belle_sip_header_content_type_create("application", "dtmf-relay"));
|
||||
sal_op_send_request(h,req);
|
||||
}else ms_error("sal_call_send_dtmf(): could not build request");
|
||||
}else ms_error("sal_call_send_dtmf(): no dialog");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sal_call_terminate(SalOp *op){
|
||||
belle_sip_dialog_state_t dialog_state=op->dialog?belle_sip_dialog_get_state(op->dialog):BELLE_SIP_DIALOG_NULL; /*no dialog = dialog in NULL state*/
|
||||
op->state=SalOpStateTerminating;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ belle_sip_header_contact_t* sal_op_create_contact(SalOp *op,belle_sip_header_fro
|
|||
belle_sip_object_unref(req_uri);
|
||||
return contact_header;
|
||||
}
|
||||
|
||||
belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) {
|
||||
belle_sip_header_from_t* from_header;
|
||||
belle_sip_header_to_t* to_header;
|
||||
|
|
@ -109,7 +110,6 @@ belle_sip_request_t* sal_op_build_request(SalOp *op,const char* method) {
|
|||
belle_sip_header_via_new(),
|
||||
70);
|
||||
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(op->base.root->user_agent));
|
||||
return req;
|
||||
}
|
||||
|
||||
|
|
@ -180,6 +180,9 @@ static int _sal_op_send_request_with_contact(SalOp* op, belle_sip_request_t* req
|
|||
op->pending_client_trans=client_transaction; /*update pending inv for being able to cancel*/
|
||||
belle_sip_object_ref(op->pending_client_trans);
|
||||
}
|
||||
if (belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request),belle_sip_header_user_agent_t)==NULL)
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_HEADER(op->base.root->user_agent));
|
||||
|
||||
if (add_contact) {
|
||||
contact = sal_op_create_contact(op,belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(request),belle_sip_header_from_t));
|
||||
belle_sip_message_remove_header(BELLE_SIP_MESSAGE(request),BELLE_SIP_CONTACT);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue