int sal_message_send(SalOp *op, const char *from, const char *to, const char* content_type, const char *msg){ osip_message_t *sip=NULL; if(op->cid == -1) { /* we are not currently in communication with the destination */ if (from) sal_op_set_from(op,from); if (to) sal_op_set_to(op,to); sal_exosip_fix_route(op); eXosip_lock(); eXosip_message_build_request(&sip,"MESSAGE",sal_op_get_to(op), sal_op_get_from(op),sal_op_get_route(op)); if (sip!=NULL){ sal_exosip_add_custom_headers(sip,op->base.custom_headers); msg_add_current_date(sip); osip_message_set_content_type(sip,content_type); if (msg) osip_message_set_body(sip,msg,strlen(msg)); sal_add_other(op->base.root,op,sip); eXosip_message_send_request(sip); }else{ ms_error("Could not build MESSAGE request !"); } eXosip_unlock(); } else { /* we are currently in communication with the destination */ eXosip_lock(); //First we generate an INFO message to get the current call_id and a good cseq eXosip_call_build_request(op->did,"MESSAGE",&sip); if(sip == NULL) { ms_warning("could not get a build info to send MESSAGE, maybe no previous call established ?"); eXosip_unlock(); return -1; } sal_exosip_add_custom_headers(sip,op->base.custom_headers); msg_add_current_date(sip); osip_message_set_content_type(sip,content_type); if (msg) osip_message_set_body(sip,msg,strlen(msg)); eXosip_call_send_request(op->did,sip); eXosip_unlock(); } return 0; }
MY_DLLEXPORT OWPL_RESULT owplCallUnholdWithBody(const OWPL_CALL hCall, const char * szContentType, const char * szBody, int BodySize) { phcall_t *ca = ph_locate_call_by_cid(hCall); int i; if(!ca) { return OWPL_RESULT_FAILURE; } if(ca->localhold != 1) { return OWPL_RESULT_FAILURE; } ca->localhold = 0; eXosip_lock(); i = eXosip_off_hold_call_with_body(ca->did, szContentType, szBody); eXosip_unlock(); if(i==0) { return OWPL_RESULT_SUCCESS; } return OWPL_RESULT_FAILURE; }
int main ( int argc, char *argv[] ) { int i, port = 5060; osip_trace_initialize_func(END_TRACE_LEVEL, &android_trace_func); i=eXosip_init(); if (i!=0) return -1; i = eXosip_listen_addr (IPPROTO_UDP, NULL, port, AF_INET, 0); if (i!=0) { eXosip_quit(); __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "%s", "could not initialize transport layer\n"); return -1; } eXosip_event_t *je; for (;;) { je = eXosip_event_wait (0, 24*60*60*1000); eXosip_lock(); eXosip_automatic_action (); eXosip_unlock(); if (je == NULL) break; if (je->type == EXOSIP_CALL_INVITE) { __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s", "incoming call\n"); std::cout << "incoming call" << std::endl; } } return 0; } // ---------- end of function main ----------
OWPL_RESULT owplPresenceUnsubscribe(OWPL_SUB hSub) { int i = 0; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } eXosip_lock(); i = eXosip_subscribe_close(hSub); eXosip_unlock(); if(i != 0) { owplFireSubscriptionEvent(hSub, OWPL_SUBSCRIPTION_CLOSE_FAILED, SUBSCRIPTION_CAUSE_UNKNOWN, NULL, NULL); } else { owplFireSubscriptionEvent(hSub, OWPL_SUBSCRIPTION_CLOSED, SUBSCRIPTION_CAUSE_NORMAL, NULL, NULL); } return OWPL_RESULT_SUCCESS; }
/** * Sends a SUBSCRIBE message to a sip URI. * * @param hLine The handle to the line. * @param szUri Sip address of the person to subscribe to * @param winfo 0: Subscribe for presence 1: Subscribe for watcher info * @param hSub The handle to this subscription */ MY_DLLEXPORT OWPL_RESULT owplPresenceSubscribe(OWPL_LINE hLine, const char* szUri, const int winfo, OWPL_SUB *hSub) { char UriBuf[100]; char MsgBodyBuf[500]; char ProxyBuf[100]; int n = sizeof(UriBuf); int i; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } owplLineGetUri(hLine, UriBuf, &n); n = sizeof(ProxyBuf); owplLineGetProxy(hLine, ProxyBuf, &n); eXosip_lock(); i = eXosip_subscribe(szUri, UriBuf, ProxyBuf, winfo); eXosip_unlock(); if (i < 0) { return OWPL_RESULT_FAILURE; } if (hSub) { *hSub = i; } return OWPL_RESULT_SUCCESS; }
static void * register_proc (void *arg) { struct regparam_t *regparam = arg; int reg; for (;;) { #ifdef _WIN32_WCE Sleep ((regparam->expiry / 2) * 1000); #else sleep (regparam->expiry / 2); #endif eXosip_lock (context_eXosip); reg = eXosip_register_send_register (context_eXosip, regparam->regid, NULL); if (0 > reg) { #ifdef _WIN32_WCE fprintf (stdout, "eXosip_register: error while registring"); #else perror ("eXosip_register"); #endif exit (1); } regparam->auth = 0; eXosip_unlock (context_eXosip); } return NULL; }
OWPL_RESULT owplCallConnectWithBody(const OWPL_CALL hCall, const char* szAddress, const char* szContentType, const char* szBody, int BodySize) { int i; osip_message_t *invite; char *proxy ; phVLine *vl; char from[512]; OWSIPAccount account ; phcall_t *ca = ph_locate_call_by_cid(hCall); if (ca == NULL) { return OWPL_RESULT_INVALID_ARGS ; } account = owplLineSipAccountGet (ca->vlid) ; if (account <= 0) { return OWPL_RESULT_INVALID_ARGS ; } // TODO verif des arguments if (!szAddress){ return OWPL_RESULT_INVALID_ARGS; } vl = ph_valid_vlid(ca->vlid); if (!vl) { return OWPL_RESULT_INVALID_ARGS; } ph_vline_get_from(from, sizeof(from), vl); proxy = owsip_account_proxy_get (account) ; if((i = eXosip_build_initial_invite(&invite, (char *)szAddress, from, proxy, "")) != 0){ return -1; } eXosip_lock(); i = eXosip_initiate_call_with_body(account, invite, szContentType, szBody, 0); if (i <= 0) { return OWPL_RESULT_FAILURE; } ca->extern_cid = i; ca->vlid = ph_vline2vlid(vl); eXosip_unlock(); owplAssociateCall2PluginByContentType(ca->cid, szContentType); return OWPL_RESULT_SUCCESS; }
MY_DLLEXPORT OWPL_RESULT owplPresenceUnsubscribe(const char * szRemoteUri) { OWPL_SUB hSub; int i = 0; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } if(szRemoteUri == NULL || strlen(szRemoteUri) <= 0) { return OWPL_RESULT_INVALID_ARGS; } eXosip_lock(); i = eXosip_get_subscribe_id(szRemoteUri, &hSub); if(i == 0) { i = eXosip_subscribe_close(hSub); } eXosip_unlock(); if(i != 0) { owplFireSubscriptionEvent(hSub, OWPL_SUBSCRIPTION_CLOSE_FAILED, SUBSCRIPTION_CAUSE_UNKNOWN, szRemoteUri); } else { owplFireSubscriptionEvent(hSub, OWPL_SUBSCRIPTION_CLOSED, SUBSCRIPTION_CAUSE_NORMAL, szRemoteUri); } return OWPL_RESULT_SUCCESS; }
int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus presence_mode){ osip_message_t *pub; int i; char buf[1024]; const char *route=sal_op_get_route(op); mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style); i = eXosip_build_publish(&pub,to, from, NULL, "presence", "600", presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf); if (i<0){ ms_warning("Failed to build publish request."); return -1; } if (route) sal_message_add_route(pub,route); eXosip_lock(); i = eXosip_publish(pub, to); /* should update the sip-if-match parameter from sip-etag from last 200ok of PUBLISH */ eXosip_unlock(); if (i<0){ ms_message("Failed to send publish request."); return -1; } sal_add_other(sal_op_get_sal(op),op,pub); return 0; }
int uac_token_exchange(const sip_entity* to,const TokenType toketype_) { eXosip_event_t *event; if(send_token(to,toketype_)<1) { printf("send_token error\n"); return 0; } if(uac_waitfor(NULL,EXOSIP_MESSAGE_NEW,&event)<1) { printf("uac_waitfor error event->type:%d\n",event->type); return 0; } if(handle_token(event->request,toketype_)<1) { printf("handle_token error\n"); return 0; } osip_message_t *g_answer = NULL;/*请求的确认型应答*/ eXosip_lock(); eXosip_message_build_answer(event->tid, 200, &g_answer);/*Build default Answer for request*/ eXosip_message_send_answer(event->tid, 200, g_answer);/*按照规则回复200OK*/ eXosip_unlock(); eXosip_event_free (event); printf("uac_token_exchange-----finished\n"); return 1; }
static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ osip_message_t *msg; eXosip_lock(); eXosip_register_build_register(obj->rid,obj->expires,&msg); eXosip_register_send_register(obj->rid,msg); eXosip_unlock(); }
/*presence Subscribe/notify*/ int sal_subscribe_presence(SalOp *op, const char *from, const char *to){ osip_message_t *msg=NULL; if (from) sal_op_set_from(op,from); if (to) sal_op_set_to(op,to); sal_exosip_fix_route(op); eXosip_lock(); eXosip_subscribe_build_initial_request(&msg,sal_op_get_to(op),sal_op_get_from(op), sal_op_get_route(op),"presence",600); if (msg==NULL){ ms_error("Could not build subscribe request to %s",to); eXosip_unlock(); return -1; } if (op->base.contact){ _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free); osip_message_set_contact(msg,op->base.contact); } op->sid=eXosip_subscribe_send_initial_request(msg); eXosip_unlock(); if (op->sid==-1){ osip_message_free(msg); return -1; } sal_add_out_subscribe(op->base.root,op); return 0; }
int uas_unregist(sipua_uas_t *sipuas, char *userloc, char *registrar, char *id) { int ret; int regno = -1; /* eXosipua_t *jua = (eXosipua_t*)sipuas; */ eXosip_lock(); regno = eXosip_register_init(userloc, registrar, id); if (regno < 0) { eXosip_unlock(); return UA_FAIL; } ret = eXosip_register(regno, 0); eXosip_unlock(); if(ret != 0) return UA_FAIL; return UA_OK; }
void linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){ osip_message_t *msg; const char *rport,*received; osip_via_t *via=NULL; osip_generic_param_t *param=NULL; osip_contact_t *ctt=NULL; osip_message_get_via(last_answer,0,&via); if (!via) return; osip_via_param_get_byname(via,"rport",¶m); if (param) rport=param->gvalue; else return; param=NULL; osip_via_param_get_byname(via,"received",¶m); if (param) received=param->gvalue; else return; osip_message_get_contact(orig_request,0,&ctt); if (strcmp(ctt->url->host,received)==0 && (ctt->url->port!=0 && strcmp(ctt->url->port,rport)==0)){ ms_message("Register has up to date contact, doing nothing."); return; } eXosip_lock(); eXosip_register_build_register(obj->rid,obj->expires,&msg); osip_message_get_contact(msg,0,&ctt); if (ctt->url->host!=NULL){ osip_free(ctt->url->host); } ctt->url->host=osip_strdup(received); if (ctt->url->port!=NULL){ osip_free(ctt->url->port); } ctt->url->port=osip_strdup(rport); eXosip_register_send_register(obj->rid,msg); eXosip_unlock(); ms_message("Resending new register with updated contact %s:%i",received,rport); }
int uas_retry_call(sipua_uas_t *sipuas, sipua_call_t* call) { eXosip_lock(); eXosip_retry_call(call->cid); eXosip_unlock(); return UA_OK; }
OWPL_RESULT owplPresencePublish(OWPL_LINE hLine, const int Online, const char * szStatus, OWPL_PUB *hPub) { char UriBuf[100]; char MsgBodyBuf[500]; char ProxyBuf[100]; int n = sizeof(UriBuf); int i; phVLine * vl = NULL; OWSIPAccount account ; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } account = owplLineSipAccountGet (hLine) ; if (account <= 0) { return OWPL_RESULT_INVALID_ARGS ; } // save infos for later user from a timer event if((vl = ph_valid_vlid(hLine)) != NULL) { vl->publishInfo.onlineState = Online; if (szStatus) { vl->publishInfo.szStatus = strdup(szStatus); } else { vl->publishInfo.szStatus = strdup(""); } vl->publishInfo.hPub = hPub; // nine minutes timeout i.e. 540s vl->publishInfo.publishTimeout = 540; vl->publishInfo.lastPublishTime = time(0); } else { return OWPL_RESULT_FAILURE; } buildPidfPayload(hLine, MsgBodyBuf, sizeof(MsgBodyBuf), Online, szStatus); n = sizeof(UriBuf); owplLineGetUri(hLine, UriBuf, &n); n = sizeof(ProxyBuf); owplLineGetProxy(hLine, ProxyBuf, &n); eXosip_lock(); i = eXosip_publish(account, UriBuf, UriBuf, ProxyBuf, 0, PRESENCE_CONTENT_TYPE, MsgBodyBuf); eXosip_unlock(); if (i != 0) { return OWPL_RESULT_FAILURE; } return OWPL_RESULT_SUCCESS; }
int uas_regist(sipua_uas_t *sipuas, int *regno, char *loc, char *registrar, char *id, int seconds) { int ret; eXosipua_t *jua = (eXosipua_t*)sipuas; char* siploc, *p; p = siploc = xmalloc(4+strlen(loc)+1+10+1); if(!siploc) return UA_FAIL; strcpy(p, "sip:"); p += 4; strcpy(p, loc); while(*p) p++; snprintf(p, 12, ":%d", sipuas->portno); jua_debug(("uas_regist: %s on %s within %ds\n", id, registrar, seconds)); eXosip_lock(); if(*regno < 0) { *regno = eXosip_register_init(id, registrar, siploc); if (*regno < 0) { eXosip_unlock(); return UA_FAIL; } } ret = eXosip_register(*regno, seconds); eXosip_unlock(); xfree(siploc); if(ret != 0) { jua_debug(("uas_regist: ret=%d\n", ret)); return UA_FAIL; } if(!jua->thread) { jua->thread = xthr_new(jua_loop, jua, XTHREAD_NONEFLAGS); if(!jua->thread) return UA_FAIL; } return UA_OK; }
OWPL_RESULT owplMessageSend(OWPL_LINE hLine, const char * szRemoteUri, const char * szContent, const char * szMIME, int * messageId) { phVLine *vl; char from[512]; OWSIPAccount account ; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } account = owplLineSipAccountGet (hLine) ; if (account <= 0) { return OWPL_RESULT_INVALID_ARGS ; } if(hLine <= 0 || szRemoteUri == NULL || strlen(szRemoteUri) <= 0 || szMIME == NULL || strlen(szMIME) <= 0 || szContent == NULL || strlen(szContent) <= 0 || messageId == NULL) { return OWPL_RESULT_INVALID_ARGS; } vl = ph_valid_vlid(hLine); if(!vl) { return OWPL_RESULT_INVALID_ARGS; } ph_vline_get_from(from, sizeof(from), vl); eXosip_lock(); * messageId = eXosip_message ( account, (char *) szRemoteUri, from, owsip_account_proxy_get (account), (char *) szContent, (char *) szMIME ) ; eXosip_unlock(); return OWPL_RESULT_SUCCESS; }
int phvlRegister(int vlid) { phVLine *vl = ph_vlid2vline(vlid); int ret = -1; char utmp[256]; char stmp[256]; char *server; assert(vl); assert(vl->username); assert(vl->server); snprintf(utmp, sizeof(utmp), "sip:%s@%s", vl->username, vl->server); server = stmp; if (vl->port && vl->port != 5060) { /* snprintf(stmp, sizeof(stmp), "sip:%s@%s:%d", vl->username, vl->server, vl->port); */ snprintf(stmp, sizeof(stmp), "sip:%s:%d", vl->server, vl->port); } else { /* snprintf(stmp, sizeof(stmp), "sip:%s@%s:%d", vl->username, vl->server, vl->port); */ snprintf(stmp, sizeof(stmp), "sip:%s", vl->server); } eXosip_lock(); vl->rid = eXosip_register_init(utmp, server, vl->contact, vl->proxy); if (vl->rid >= 0) { if (vl->regTimeout > 0) { _owplLineSetState(vlid, LINESTATE_REGISTERING, LINESTATE_CAUSE_NORMAL); } else { _owplLineSetState(vlid, LINESTATE_UNREGISTERING, LINESTATE_CAUSE_NORMAL); } ret = eXosip_register(vl->rid, vl->regTimeout); if (ret == 0) { ret = vl->rid; vl->lastRegTime = time(0); } } eXosip_unlock(); return ret; }
eXosip_event_t * eXosip_event_wait (int tv_s, int tv_ms) { eXosip_event_t *je = NULL; je = (eXosip_event_t *) osip_fifo_tryget (eXosip.j_events); if (je != NULL) return je; eXosip_lock(); eXosip_retransmit_lost200ok(); eXosip_unlock(); return NULL; }
int uac_waitfor(const sessionId* id, const eXosip_event_type_t t,eXosip_event_t **event) { eXosip_event_t *g_event = NULL;/*消息事件*/ while(1) { /*等待新消息的到来*/ g_event = eXosip_event_wait(0, 50);/*侦听消息的到来*/ eXosip_lock(); eXosip_default_action(g_event); eXosip_automatic_refresh();/*Refresh REGISTER and SUBSCRIBE before the expiration delay*/ eXosip_unlock(); if ( g_event == NULL) { continue; } if(g_event->request==NULL) { continue; } if(id!=NULL && strcmp(id->call_id,g_event->request->call_id->number)) { printf("id->call_id:%s g_event->request->call_id->number:%s\n", id->call_id, g_event->request->call_id->number); printf("id!=NULL &&\n"); continue; } if(g_event->type==EXOSIP_CALL_RINGING || g_event->type==EXOSIP_MESSAGE_ANSWERED) { continue; } if(g_event->type==t) { (*event)=g_event; return 1; } else { (*event)=g_event; return 0; } } if(event==NULL) { printf("no response\n\n"); return 0; } return 0; }
void linphone_proxy_config_edit(LinphoneProxyConfig *obj){ obj->frozen=TRUE; if (obj->reg_sendregister){ /* unregister */ if (obj->registered) { osip_message_t *msg; eXosip_lock(); eXosip_register_build_register(obj->rid,0,&msg); eXosip_register_send_register(obj->rid,msg); eXosip_unlock(); obj->registered=FALSE; } } }
int uac_bye(const sessionId Id) { eXosip_lock(); eXosip_call_terminate( Id.cid, Id.did); eXosip_unlock(); eXosip_event_t *g_event = NULL;/*消息事件*/ uac_waitfor(&Id,EXOSIP_CALL_MESSAGE_ANSWERED,&g_event); if(!g_event) { printf("no bye response\n"); return 0; } eXosip_event_free (g_event); return 1; }
int sal_notify_close(SalOp *op){ osip_message_t *msg=NULL; eXosip_lock(); eXosip_insubscription_build_notify(op->did,EXOSIP_SUBCRSTATE_TERMINATED,DEACTIVATED,&msg); if (msg!=NULL){ const char *identity=sal_op_get_contact(op); if (identity==NULL) identity=sal_op_get_to(op); osip_message_set_contact(msg,identity); add_presence_body(msg,SalPresenceOffline); eXosip_insubscription_send_request(op->did,msg); }else ms_error("sal_notify_close(): could not create notify for incoming subscription" " did=%i, nid=%i",op->did,op->nid); eXosip_unlock(); return 0; }
int sal_unsubscribe(SalOp *op){ osip_message_t *msg=NULL; if (op->did==-1){ ms_error("cannot unsubscribe, no dialog !"); return -1; } eXosip_lock(); eXosip_subscribe_build_refresh_request(op->did,&msg); if (msg){ osip_message_set_expires(msg,"0"); eXosip_subscribe_send_refresh_request(op->did,msg); }else ms_error("Could not build subscribe refresh request ! op->sid=%i, op->did=%i", op->sid,op->did); eXosip_unlock(); return 0; }
int uac_sendInvite(sessionId * id, const sip_entity* to, const alter_message * alter_m) {// char * to, char * message, char *meessageType,char *subject osip_message_t *invite; int i;// optionnal route header char to_[100]; snprintf (to_, 100,"sip:%s@%s", to->username,to->ip); char from_[100]; snprintf (from_, 100,"sip:%s@%s:%s",device_info.ipc_id, device_info.ipc_ip ,device_info.ipc_port ); i = eXosip_call_build_initial_invite (&invite,to_,from_,NULL,alter_m->subject ); if (i != 0) { return -1; } //osip_message_set_supported (invite, "100rel"); { char localip[128]; eXosip_guess_localip (AF_INET, localip, 128); i=osip_message_set_body (invite, alter_m->body, strlen (alter_m->body)); i=osip_message_set_content_type (invite, alter_m->content_type); } eXosip_lock (); i = eXosip_call_send_initial_invite (invite); eXosip_unlock (); //printf("invite->call_id->number:%s size:%d\n",invite->call_id->number,strlen(invite->call_id->number)); //id->call_id=(char *)malloc(sizeof(char)*(strlen(invite->call_id->number)+1)); int copynum=0; if(sizeof(id->call_id)>(strlen(invite->call_id->number)+1)) { copynum=(strlen(invite->call_id->number)+1); } else { copynum=sizeof(id->call_id); } memcpy(id->call_id,invite->call_id->number,copynum);//strlen(invite->call_id->number)+1); //if (i > 0) //{ //eXosip_call_set_reference (i, "ssss"); //} return 0; }
int sal_subscribe_accept(SalOp *op){ osip_message_t *msg=NULL; eXosip_lock(); eXosip_insubscription_build_answer(op->tid,202,&msg); if (msg==NULL){ ms_error("Fail to build answer to subscribe."); eXosip_unlock(); return -1; } if (op->base.contact){ _osip_list_set_empty(&msg->contacts,(void (*)(void*))osip_contact_free); osip_message_set_contact(msg,op->base.contact); } eXosip_insubscription_send_answer(op->tid,202,msg); eXosip_unlock(); return 0; }
MY_DLLEXPORT OWPL_RESULT owplPresencePublish(OWPL_LINE hLine, const int Online, const char * szStatus, OWPL_PUB *hPub) { char UriBuf[100]; char MsgBodyBuf[500]; char ProxyBuf[100]; int n = sizeof(UriBuf); int i; phVLine * vl = NULL; // SPIKE_SPIKE_SIP_SIMPLE if (phcfg.pim_disabled) { return OWPL_RESULT_SUCCESS; } // save infos for later user from a timer event if((vl = ph_valid_vlid(hLine)) != NULL) { vl->publishInfo.onlineState = Online; if(szStatus != NULL) { vl->publishInfo.szStatus = strdup(szStatus); } vl->publishInfo.hPub = hPub; // nine minutes timeout i.e. 540s vl->publishInfo.publishTimeout = 540; vl->publishInfo.lastPublishTime = time(0); } else { return OWPL_RESULT_FAILURE; } owplLineGetUri(hLine, UriBuf, &n); snprintf(MsgBodyBuf, sizeof(MsgBodyBuf), PUBLISH_MSG_TEMPLATE, UriBuf, Online ? "open" : "close", szStatus, UriBuf); n = sizeof(ProxyBuf); owplLineGetProxy(hLine, ProxyBuf, &n); eXosip_lock(); i = eXosip_publish(UriBuf, UriBuf, ProxyBuf, 0, PRESENCE_CONTENT_TYPE, MsgBodyBuf); eXosip_unlock(); if (i != 0) { return OWPL_RESULT_FAILURE; } return OWPL_RESULT_SUCCESS; }
int uac_send_noSessionMessage(const sip_entity* to_, const alter_message * alter_m) {//,char * to, char * from, char * route,char * content,char * subject osip_message_t *message; char from[4+CHARLEN+1+15+1+4+1]; char to[4+CHARLEN+1+15+1+4+1]; snprintf(from,sizeof(from),"sip:%s@%s:%s",device_info.ipc_id,device_info.ipc_ip,device_info.ipc_port); snprintf(to,sizeof(to),"sip:%s@%s:%d",to_->username,to_->ip,to_->port); eXosip_lock (); eXosip_message_build_request (&message, alter_m->method_type, to,from, alter_m->route); if(alter_m->subject!=NULL) osip_message_set_subject(message,alter_m->subject); osip_message_set_body(message,alter_m->body,strlen(alter_m->body)); osip_message_set_content_type(message,alter_m->content_type); eXosip_message_send_request(message); eXosip_unlock (); return 1; }
int uac_send_message(const sessionId Id, const alter_message * alter_m) { osip_message_t *message; int i; eXosip_lock (); i = eXosip_call_build_request (Id.did,alter_m->method_type/*"MESSAGE" or "INFO"*/, &message); if (i == 0) { if(alter_m->content_type!=NULL) osip_message_set_content_type (message, alter_m->content_type/*"Application/MANSRTSP"*/); if(alter_m->subject!=NULL) osip_message_set_subject(message,alter_m->subject); osip_message_set_body (message, alter_m->body, strlen (alter_m->body)); i = eXosip_call_send_request (Id.did, message); } eXosip_unlock (); return i; }