linphone 分析3 打电话源码分析

lpc_cmd_call(LinphoneCore *lc, char *args)

{

if ( ! args || ! *args )

{

return 0;

}

{

LinphoneCall *call;

LinphoneCallParams *cp=linphone_core_create_default_call_parameters (lc);

char *opt1,*opt2;

if ( linphone_core_in_call(lc) )

{

linphonec_out("Terminate or hold on the current call first.\n");

return 1;

}

opt1=strstr(args,"--audio-only");//audio-only 是要语音的参数

opt2=strstr(args,"--early-media");//video-only 是要视频的参数

if (opt1){

opt1[0]='\0';

linphone_call_params_enable_video (cp,FALSE);

}

if (opt2){

opt2[0]='\0';

linphone_call_params_enable_early_media_sending(cp,TRUE);

}

if ( NULL == (call=linphone_core_invite_with_params(lc, args,cp)) )

{

linphonec_out("Error from linphone_core_invite.\n");

}

else

{

snprintf(callee_name,sizeof(callee_name),"%s",args);

}

linphone_call_params_destroy(cp);

}

return 1;

}

 

 

 

 

 

 

 

 

LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *url, const LinphoneCallParams *p){

LinphoneAddress *addr=linphone_core_interpret_url(lc,url);  字符串到LinphoneAddress 转换(to的地址

if (addr){

LinphoneCall *call;

call=linphone_core_invite_address_with_params(lc,addr,p); 

linphone_address_destroy(addr);

return call;

}

return NULL;

}

 

 

 

 

LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params)

{

LinphoneCall *call=ms_new0(LinphoneCall,1);

call->dir=LinphoneCallOutgoing;

call->op=sal_op_new(lc->sal);

sal_op_set_user_pointer(call->op,call);

call->core=lc;

linphone_core_get_local_ip(lc,NULL,call->localip);

linphone_call_init_common(call,from,to);//在这里计数:refcnt=1,设置引用基数.

_linphone_call_params_copy(&call->params,params); //本地媒体类型描述

sal_op_set_custom_header(call->op,call->params.custom_headers);

call->params.custom_headers=NULL;

if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {

call->ice_session = ice_session_new();

ice_session_set_role(call->ice_session, IR_Controlling);

}

if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {

call->ping_time=linphone_core_run_stun_tests(call->core,call);

}

#ifdef BUILD_UPNP

if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseUpnp) {

if(!lc->rtp_conf.disable_upnp) {

call->upnp_session = linphone_upnp_session_new(call);

}

}

#endif //BUILD_UPNP

call->camera_active=params->has_video;

discover_mtu(lc,linphone_address_get_domain (to));

if (params->referer){

sal_call_set_referer(call->op,params->referer->op);

call->referer=linphone_call_ref(params->referer);

}  是否是呼叫转移

return call;

}

 

 

 

 

 

 

LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const LinphoneAddress *addr, const LinphoneCallParams *params)

 

{

const char *route=NULL;

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值