Regarding the asterisk External Media over Websocket

Hi Team , as i have highlighted the issue of codec support issue on the asterisk

which has been successfully resovled in this release

but i also saw some issue in this websocket the problem is that when we use the asterisk external media over websocket

when the asterisk connect to the websocket i mentioned in the external media the data i received on the websocket 1st time is this

MEDIA_START connection_id:ace_media_ws channel:WebSocket/media_ws/0x77049c004260 format:slin16 optimal_frame_size:640 ptime:20

only i dont receive any other information on this socket and there is not option to send anything over this

so i recommend that can it be possible to send the externalmedia channelid which is already created when we do createExternalMedia can we send that id on this so that we can have the reference of which channel is this socket channel

and if not this can any way we can send custom variables to this on somehow

let externalMediaId = randomString();
await channel.externalMedia(
    {
        channelId      : externalMediaId,
        app            : `${constants.CALL_TYPE},chanType:streaming`,
        external_host  : 'media_ws',
        format         : "slin16",
        transport      : "websocket",
        encapsulation  : "none",
        connection_type: "client",
        direction      : "both",

    });

If this is for outgoing websocket connections, then the ability to have parameters in the URI was added:

And the normal originate functionality can be used instead of externalmedia route in ARI.

Yes @jcolp , i have checked this but i believe this is the same thing i mentioned in the previous issue also i am using asterisk ari client library where when i pass like

channel.externalMedia(
        {
            channelId      : externalMediaId,
            app            : `${constants.CALL_TYPE},chanType:streaming`,
            external_host  : 'ace_media_ws',
            format         : "slin16",
            transport      : "websocket",
            encapsulation  : "none",
            connection_type: "client",
            direction      : "both",
            variables: {
                "name":"gaurav"
            }

        });

i donot received that variable in asterisk -rvv it shows

the same thing happen in codec side but gtjoseph has done some changes in code and then it works using ari client also

I did not mention channel variables going over the websocket. What I posted was the ability to put query parameters in the URL that the websocket uses for establishing the outgoing connection, which can then be used by the receiver of the HTTP request.

@jcolp on the github post

same => n,Dial(Websocket/connection1/c(slin16)v(variable=${CHANNEL},variable2=${EXTEN}))

MEDIA_START connection_id:e226e283-c90a-4ea9-9e37-389000b9ef47
    channel:WebSocket/connectionid format:ulaw optimal_frame_size:160
    variable:PJSIP/aslice-00000000 variable2:1000

it is mentioned and this is using Dial applicaiton of asterisk and then passing v and then variables i am saying i am using asterisk ari-client node js library i am not using the dial application for dialing this channel
i am using

library to create the external media channel and it automatically create the channel internall how to i pass the variables in this

You can use the normal Originate route[1] like other channels and like Dial, but passing in a full Dial string including v arguments with the contents as you like. Because it’s not dialplan, though, you can’t pass in dialplan variables. You pass in a complete string.

[1] Channels - Asterisk Documentation

Agreed @jcolp , but then the usecase of using this Asteirsk ari library will not be used because in this library it do accepts the variables key and can we use the variables key as create the string as v
because this library also fixes the codec supports in previous issue
gtjoseph
has done changes but then also i want not able to use the c in asterisk ari library then
gtjoseph
done some changes again then it automatically get added in the string the same way i believe this can be resolved

i request you please take a look into this if this is possible then complete node ari client library will be perfect

I feel like I’m going in circles, so I’m going to bow out of this thread.

1 Like

@gjoseph can you please help here and give your inputs you have fixed this in previous isssue

@gauravs456 Please do not create duplicate posts for the same thing.

@gauravs456 I think what you’re saying is that in the MEDIA_START message you get the channel name (WebSocket/media_ws/0x77049c004260) but you don’t get the channel id (1760736676.24) which is what you need to make other ARI calls for that channel. Is that right?

Hi @gjoseph, yes you are right channelId of this external media channel is not there which i think is necessary and also there is a closed issue you mentioned to pass custom variables

but i tried to pass the variable like the above code snippet but on asterisk rvvv loga its not coming

i guess it has to come like in V () parameter right how can i do that

and also i there is a leverage of sending custom parameter in external media the it would be the best solution

then i can send whatever i want

which i believe you have done that but this is not working using asterisk ari client library

@jcolp i thought that the previous issue category was asterisk api now is development

i was not aware of that

i will keep in mind from now on

Hi @gjoseph , Yes you are right

OK go ahead and open an ā€œimprovementā€ issue at Asterisk Issues and I’ll see what I can do.

Sure @gjoseph I am creating That but can you please confirm the issue that mentioned above that is passing custom uri parameters that you have done, how can i see if it is working and which part are you talking about for creating the issue
there are 2 things

  1. having the channelId in the MediaConnected message
  2. i can pass custom variables that can self resolve the 1st point
    which point you are referring to ? and can you please check it this points are working at your end
    because i checked at my end its not working i checked 2nd point

Hi @gjoseph
I have created the improvement issue and mentioned all the thing in description

as you mentioned i have made two different task for it

1st Pointer Issue :

2nd Pointer Issue :

Hi @gjoseph , I just wanted to tell that i have done these changes and its my first time to work on open source project, can you please guide me how can i push my branch so that you can review my code if possible

The best place to start is here…

Hi @gjoseph, done

can you please check this