eXosip使用实例 下载本文

内容发布更新时间 : 2024/5/20 0:55:16星期一 下面是文章的全部内容请认真阅读。

case EXOSIP_CALL_INVITE: printf(\ break; case EXOSIP_CALL_PROCEEDING: //收到100try printf(\ break; case EXOSIP_CALL_RINGING: printf(\ break;

case EXOSIP_CALL_ANSWERED: printf(\ //g_call_id = je->cid; //g_dialog_id = je->did; eXosip_lock(); eXosip_call_build_ack(je->did,&ack_m); eXosip_call_send_ack(je->did,ack_m); eXosip_unlock(); invite_flg = 0; break; case EXOSIP_CALL_CLOSED: //a BYE was received for this call printf(\ break; case EXOSIP_CALL_ACK: printf(\ break;

default: printf(\ if(je->response && (je->response->status_code == 486)) { osip_header_t* retryafter = NULL; osip_message_get_retry_after(je->response, 0, &retryafter); printf(\ invite_flg = 0; //eXosip_event_free(je); } break; } //end switch

eXosip_event_free(je);

} //end while return 0; }

int unhold() { int invite_flg = 1; osip_message_t * invite_m = NULL; eXosip_event_t * je = NULL; osip_message_t * ack_m = NULL; static char body[4096] = {0}; if(eXosip_call_build_request(g_dialog_id, \ { printf(\ return -1; } memset(body,0,4096); snprintf(body,4096, \ \ \ \ \ \ \ \ \ \ localip,localip); osip_message_set_body(invite_m,body,strlen(body)); osip_message_set_content_type(invite_m,\ eXosip_lock(); eXosip_call_send_request(g_dialog_id, invite_m); eXosip_unlock(); while(invite_flg) {

printf(\

je = eXosip_event_wait(ring_timeout,0); printf(\ if(je != NULL) ;//printEventType(je); else { printf(\ return -2; } eXosip_lock(); eXosip_default_action(je); eXosip_automatic_refresh(); eXosip_unlock(); switch(je->type) { case EXOSIP_CALL_INVITE: printf(\ break;

case EXOSIP_CALL_PROCEEDING: //收到100try printf(\ break; case EXOSIP_CALL_RINGING: printf(\ break;

case EXOSIP_CALL_ANSWERED: printf(\ //g_call_id = je->cid; //g_dialog_id = je->did; eXosip_lock(); eXosip_call_build_ack(je->did,&ack_m); eXosip_call_send_ack(je->did,ack_m); eXosip_unlock(); invite_flg = 0; break; case EXOSIP_CALL_CLOSED: //a BYE was received for this call printf(\ break; case EXOSIP_CALL_ACK:

printf(\ break; default: printf(\ if(je->response && (je->response->status_code == 486)) { osip_header_t* retryafter = NULL; osip_message_get_retry_after(je->response, 0, &retryafter); printf(\ invite_flg = 0; //eXosip_event_free(je); } break; } //end switch eXosip_event_free(je); } //end while return 0; }

int quit() { eXosip_quit(); printf(\ flag = 0; return 0; }

int show() { //if(je != NULL) // printf(\ \\n\ printf(\ return 0; }

void test()

{ char local[20] = {0}; eXosip_guess_localip(AF_INET,local,19); printf(\ exit(0); }

int main(int argc,char *argv[]) { int i = 0; eXosip_event_t * je = NULL; char command[10] = {0}; sprintf(reg_from,\ sprintf(registrar,\ sprintf(contact,\ printf(\ 注册\\n\ printf(\ 注销\\n\ printf(\ 发起呼叫\\n\ printf(\ 挂断\\n\ printf(\ 保持\\n\ printf(\ 去保持\\n\ printf(\ 退出程序\\n\ printf(\ 显示各种id\\n\

TRACE_INITIALIZE(8, NULL); //打开osip log用的 i = eXosip_init();

if(i != 0) { printf(\ return -1; } else { printf(\