From 0b32c8f1a333acbf975779437282840eaaa3c59c Mon Sep 17 00:00:00 2001 From: smorlat Date: Thu, 5 Feb 2009 16:43:54 +0000 Subject: [PATCH] merge g722 stuff for msrtp.c wip for linphonecsh git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@243 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/console/commands.c | 41 +++++++++++++++++++++++ linphone/console/shell.c | 51 +++++++++++++++++++++++++++++ linphone/mediastreamer2/src/msrtp.c | 8 +++-- 3 files changed, 98 insertions(+), 2 deletions(-) diff --git a/linphone/console/commands.c b/linphone/console/commands.c index 6d03d5956..1dd464f27 100644 --- a/linphone/console/commands.c +++ b/linphone/console/commands.c @@ -58,6 +58,7 @@ static int lpc_cmd_friend(LinphoneCore *, char*); static int lpc_cmd_soundcard(LinphoneCore *, char *); static int lpc_cmd_play(LinphoneCore *, char *); static int lpc_cmd_record(LinphoneCore *, char *); +static int lpc_cmd_register(LinphoneCore *, char *); /* Command handler helpers */ static void linphonec_proxy_add(LinphoneCore *lc); static void linphonec_proxy_display(LinphoneProxyConfig *lc); @@ -71,6 +72,8 @@ static int linphonec_friend_call(LinphoneCore *lc, unsigned int num); static int linphonec_friend_add(LinphoneCore *lc, const char *name, const char *addr); static int linphonec_friend_delete(LinphoneCore *lc, int num); + + /* Command table management */ static LPC_COMMAND *lpc_find_command(const char *name); @@ -153,6 +156,7 @@ LPC_COMMAND commands[] = { "'record ' : record into wav file." }, { "quit", lpc_cmd_quit, "Exit linphonec", NULL }, + { "register", lpc_cmd_register, "register ", NULL }, { (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL } }; @@ -1117,6 +1121,43 @@ linphonec_display_command_help(LPC_COMMAND *cmd) else linphonec_out("%s\n", cmd->help); } + +static int lpc_cmd_register(LinphoneCore *lc, char *args){ + char identity[512]; + char proxy[512]; + char passwd[512]; + LinphoneProxyConfig *cfg; + const MSList *elem; + passwd[0]=proxy[0]=identity[0]='\0'; + sscanf(args,"%s %s %s",identity,proxy,passwd); + if (proxy[0]=='\0' || identity[0]=='\0'){ + linphonec_out("Missing parameters, see help register\n"); + return 1; + } + if (passwd[0]!='\0'){ + osip_from_t *from; + LinphoneAuthInfo *info; + osip_from_init(&from); + if (osip_from_parse(from,identity)==0){ + info=linphone_auth_info_new(from->url->username,NULL,passwd,NULL,NULL); + linphone_core_add_auth_info(lc,info); + } + osip_from_free(from); + } + elem=linphone_core_get_proxy_config_list(lc); + if (elem) { + cfg=(LinphoneProxyConfig*)elem->data; + linphone_proxy_config_edit(cfg); + } + else cfg=linphone_proxy_config_new(); + linphone_proxy_config_set_identity(cfg,identity); + linphone_proxy_config_set_server_addr(cfg,proxy); + linphone_proxy_config_enable_register(cfg,TRUE); + if (elem) linphone_proxy_config_done(cfg); + else linphone_core_add_proxy_config(lc,cfg); + return 1; +} + /*************************************************************************** * * Command table management funx diff --git a/linphone/console/shell.c b/linphone/console/shell.c index 80ee23b29..0b4f6282c 100644 --- a/linphone/console/shell.c +++ b/linphone/console/shell.c @@ -133,6 +133,53 @@ static int send_generic_command(const char *command, int print_result){ return err; } +static int register_execute(int argc, char *argv[]){ + char cmd[512]; + char *username=NULL; + char *host=NULL; + char *passwd=NULL; + int i; + for(i=0;irate = pt->clock_rate; + if (strcasecmp("g722", pt->mime_type)==0 ) + d->rate=8000; + else d->rate = pt->clock_rate; } else { ms_warning("Sending undefined payload type ?"); } @@ -323,7 +325,9 @@ static int receiver_set_session(MSFilter * f, void *arg) rtp_session_get_recv_payload_type (s)); if (pt != NULL) { - d->rate = pt->clock_rate; + if (strcasecmp("g722", pt->mime_type)==0 ) + d->rate=8000; + else d->rate = pt->clock_rate; } else { ms_warning("Receiving undefined payload type ?"); }