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; }
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 owplCallGetEncryptionMode(const OWPL_CALL hCall, int * EncryptionMode) { phcall_t *ca = ph_locate_call_by_cid(hCall); if(!ca) { return OWPL_RESULT_FAILURE; } *EncryptionMode = sVoIP_phapi_isCrypted(ca->extern_cid); return OWPL_RESULT_SUCCESS; }
/** * Connect an already created call * * @param hCall The handle to the created call. * @param szAddress The SIP URI to call * @param mediaStreams The flag to say which kind of media will be available. * The value can be composed of the following bit : * OWPL_STREAM_AUDIO, OWPL_STREAM_VIDEO_RX, OWPL_STREAM_VIDEO_TX */ MY_DLLEXPORT OWPL_RESULT owplCallConnect(const OWPL_CALL hCall, const char* szAddress, int mediaStreams) { phcall_t *ca = ph_locate_call_by_cid(hCall); if (phLinePlaceCall_withCa(ca->vlid, szAddress, 0, 0, mediaStreams, ca) <= 0) { return OWPL_RESULT_FAILURE; } return OWPL_RESULT_SUCCESS; }
/** * Answer an incoming call with the specified body * * @param hCall The handle to the incoming call. * @param szContentType The content type of the message * @param body The body of the message * @param BodySize The size of the body of the message */ MY_DLLEXPORT OWPL_RESULT owplCallAnswerWithBody (const OWPL_CALL hCall, const char* szContentType, const char* szBody, int BodySize) { int i; phcall_t *ca = ph_locate_call_by_cid(hCall); if(!ca) { return OWPL_RESULT_INVALID_ARGS; } eXosip_lock(); i = eXosip_answer_call_with_body(ca->did, 200, szContentType, szBody); // returns 0 on success; -1 else eXosip_unlock(); if(i != 0) { return OWPL_RESULT_FAILURE; } return OWPL_RESULT_SUCCESS; }