Dialplan Originate - how to set codecs, enable video

I am writing a bit of dialplan where I call out to a video service and join that leg to a confbridge.

I am using the Originate application but can’t get it to offer video codecs. I have tried with both PJSIP and SIP channels.

I see that with AMI or call files you can set parameters including codecs, caller ID, etc. Is there a way to do this with the dialplan Originate application?

Use a Local Channel.

Hi David, could you explain your solution in more detail? I tried changing the originate to a local channel and it behaves exactly the same way.

You have to set things in the dialplan that is executed on the local channel.

Enabling video is done in sip.conf or pjsip.conf, not at originate time.

At your recommendation, I am doing Originate(Local/number@context, ...)

Context sends the call via SIP peer. peer is configured to allow ulaw&h264. Calls through this peer from another Asterisk endpoint (using Dial) have video.

So what else are you suggesting is needed to be set in the dialplan before the Originate?

If peer has video codec enabled, it should be offered on the SDP, also you can force codec on the dial command, check this thread

It seems that you guys are just guessing on this matter which is very unfortunate for me as I took your word for it and spent several more hours trying to make it work as you assert it should.

After enough of that, I dug into the code for app_originate and was not too surprised to find that it is hard-coded with the slin audio formats, which of course can be transcoded into any other audio format. But this excludes all video codecs, no matter whether they are set in dialplan variables, functions, or peer definitions.

A workaround for me is to modify app_originate.c to include h264 format at the end of the list of capabilities:

diff --git a/apps/app_originate.c b/apps/app_originate.c
index 107be84..6174ff2 100644
--- a/apps/app_originate.c
+++ b/apps/app_originate.c
@@ -181,6 +181,7 @@ static int originate_exec(struct ast_channel *chan, const char *data)
        ast_format_cap_append(cap_slin, ast_format_slin48, 0);
        ast_format_cap_append(cap_slin, ast_format_slin96, 0);
        ast_format_cap_append(cap_slin, ast_format_slin192, 0);
+       ast_format_cap_append(cap_slin, ast_format_h264, 0);
 
        if (ast_strlen_zero(data)) {
                ast_log(LOG_ERROR, "Originate() requires arguments\n");

This (hard-coding) is a poor solution and would be more complete if the application took an argument or checked a variable as to whether it should offer video.

1 Like

I must admit that I forgot that you needed a preferred codec before you can initiate an outgoing channel, and originate defaults to slin. AMI originate, which is what we used, does have a codecs parameter, although I don’t know if it honours video ones.

Unless you are very luck and someone has had exactly the same issue, the nature of a forum like this is that you will only get hints, and sometimes those hints will be wrong. People are not going to do detailed research before replying.

1 Like

We are not guessing, we just give you hints and thoughts and as David said unless some one had the same issue and fixed, you wont find an exact answer.realize that for your fix your issue you went to the source code of the originate app. In a peer forum nobody is diging in the source code to fix others members problems, forums are to exchange hints and thoughts , and working solution you have found before.

I wasn’t asking anyone to do deep research or examine the source code for me. Actually I thought it was reasonable that someone might have initiated video calls from Asterisk before.

So yeah, you were guessing, and I suggest that in the future if you offer help on something for which you do not have direct experience that you mention that. “I haven’t initiated video calls, but here’s something you could check…”

Thanks anyway. My opinion is that forum help is not a race; it’s better to be accurate than fast.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.