[asterisk-bugs] [JIRA] (ASTERISK-21976) Set more than one codec in dialplan execution using SIP_CODEC (adapted chan_sip:try_suggested_codec)

Matt Jordan (JIRA) noreply at issues.asterisk.org
Fri Jun 28 08:53:03 CDT 2013


     [ https://issues.asterisk.org/jira/browse/ASTERISK-21976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Jordan updated ASTERISK-21976:
-----------------------------------

    Description: 
For video calls, we would like to set the codecs in the dialplan using SIP_CODEC. However, if SIP_CODEC is set, all codecs except the ONE set are disallowed and thus either audio or video is available.

Attached is a patch for 11.4 that allows SIP_CODEC to contain a list of codecs , e.g. "gsm,h264".

Here is the code (chan_sip.c):

\[EDIT: inline code removed by mjordan\]


Do you have any feedback?

Authors: Dennis Guse (dennis.guse at qu.tu-berlin.de) und Frank Haase (fra.haase at googlemail.com).

  was:
For video calls, we would like to set the codecs in the dialplan using SIP_CODEC. However, if SIP_CODEC is set, all codecs except the ONE set are disallowed and thus either audio or video is available.

Attached is a patch for 11.4 that allows SIP_CODEC to contain a list of codecs , e.g. "gsm,h264".

Here is the code (chan_sip.c):

 static void try_suggested_sip_codec(struct sip_pvt *p)
 {
 	struct ast_format fmt;
	const char *codecList;
	char *codecListCopy;
	struct ast_format_cap *jointcapsCopy;
	char *codec;
	int firstCodec = 1;

	char *strtok_ptr;
 
 	ast_format_clear(&fmt);
 
 	if (p->outgoing_call) {
		codecList = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_OUTBOUND");
	} else if (!(codecList = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_INBOUND"))) {
		codecList = pbx_builtin_getvar_helper(p->owner, "SIP_CODEC");	
 	}
 
	if (!codecList) 
 		return;
	
	codecListCopy = ast_strdupa(codecList);
	jointcapsCopy = ast_format_cap_dup(p->jointcaps);
	for (codec = strtok_r(codecListCopy, ",", &strtok_ptr); codec; codec = strtok_r(NULL, ",", &strtok_ptr)) {
		ast_getformatbyname(ast_strip(codec), &fmt);
		if (fmt.id) {
			if (ast_format_cap_iscompatible(jointcapsCopy, &fmt)) {
				if (firstCodec) {
					ast_log(LOG_NOTICE, "Set codec to '%s' for this call because of ${SIP_CODEC} variable\n", codec);
					ast_format_cap_set(p->jointcaps, &fmt);
					ast_format_cap_set(p->caps, &fmt);
					firstCodec = 0;
				} else {
					ast_log(LOG_NOTICE, "Add codec to '%s' for this call because of ${SIP_CODEC} variable\n", codec);
					ast_format_cap_add(p->jointcaps, &fmt);
					ast_format_cap_add(p->caps, &fmt);
				}
			} else 
				ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends: %s\n", codec);
 		} else
			ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n", codec);
	}
	ast_format_cap_destroy(jointcapsCopy);
 	return;
 } 

Do you have any feedback?

Authors: Dennis Guse (dennis.guse at qu.tu-berlin.de) und Frank Haase (fra.haase at googlemail.com).

    
> Set more than one codec in dialplan execution using SIP_CODEC (adapted chan_sip:try_suggested_codec)
> ----------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-21976
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-21976
>             Project: Asterisk
>          Issue Type: Improvement
>      Security Level: None
>          Components: Channels/chan_sip/CodecHandling
>    Affects Versions: 11.4.0
>         Environment: FreeBSD (AMD64) 9.1 using Asterisk provided via ports (at the moment 11.4)
>            Reporter: Dennis Guse
>            Severity: Minor
>
> For video calls, we would like to set the codecs in the dialplan using SIP_CODEC. However, if SIP_CODEC is set, all codecs except the ONE set are disallowed and thus either audio or video is available.
> Attached is a patch for 11.4 that allows SIP_CODEC to contain a list of codecs , e.g. "gsm,h264".
> Here is the code (chan_sip.c):
> \[EDIT: inline code removed by mjordan\]
> Do you have any feedback?
> Authors: Dennis Guse (dennis.guse at qu.tu-berlin.de) und Frank Haase (fra.haase at googlemail.com).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.asterisk.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list