[ previous ] [ next ] [ threads ]
 To :  aucyxob <aucyxob@y...>
 From :  Monica Tepelus <monica@v...>
 Subject :  Re: [yate] fork for earlymedia
 Date :  Thu, 24 Jun 2010 13:13:10 +0300
Hi,

This is how i tested it:

In regexroute:

^1$=fork earlymedia sip/sip:092@1...:5061 |exec 
test;stoperror=busy;maxcall=10000

[extra]
call.execute=60

[call.execute]
${callto}^earlymedia$=return;callto=tone/info;fork.calltype=persistent;fork.autoring=true;fork.automessage=call.progress

In extmodule.conf
[scripts]
global_script.php=

And a small global script that catches call.execute with a priority 
bigger that that set above in regexroute (60)

Yate::Install("call.execute",70);

// The main loop. We pick events and handle them
for (;;) {
    $ev=Yate::GetEvent();
    // If Yate disconnected us then exit cleanly
    if ($ev === false)
    break;
    // No need to handle empty events in this application
    if ($ev === true)
    continue;
    // If we reached here we should have a valid object
    switch ($ev->type) {
    case "incoming":
        switch ($ev->name) {
            case "call.execute":
                if ($ev->getValue("callto") == "test") {
                    $ev->params["callto"] = 
"wave/play//var/spool/voicemail/greeting.au";
                    $ev->params["fork.calltype"] = "persistent";
                    $ev->params["fork.autoring"] = true;
                    $ev->params["fork.automessage"] = "call.progress";
                }
                break;
.... finish loop here (look at a sample script from share/scripts/ 
directory in yate sources)

Regexroute catches once the call.execute to set the "earlymeadia" but it 
doesn't get it again for "test"... so you need some other module to set 
this.

Regards,
Monica Tepelus

aucyxob wrote:
> Problem is not yet fixed.
>
> I have not any success with earlymedia changing.
> How can I change earlymedia in allready forked call?
> Give me work example please if possible.
>
> incoming call should be processed with follow algorithm:
> 1. have incoming call to desired number 
> 2. found appropriate target and trying connect
> 3. while all of these occurs we should hear real ring tones in the line
> 4. if the connection is unsuccessfull we should hear something like "number in not available ..." in the line as earlymedia without answer.
>
>
> 23.06.10, 17:36, "Monica Tepelus" :
>
>   
>> I saw that you asked on the yate channel.
>>  Did you fix your problem?
>>  
>>  Monica
>>  
>>  aucyxob wrote:
>>  > Sorry
>>  >
>>  > Task is bit changed
>>  > If target is not answer or fails due to any reason I should play a message via earlymedia without answer.
>>  > Does it possible to change erarly media source with targets in callfork?
>>  >
>>  > P.S.
>>  > the example of callfork from Yates site does not work:
>>  > ^1$=fork sip/sip:1@host1;fork.fake=tone/ring
>>  >
>>  > Help me please find the solution.
>>  >
>>  > Regards Anthony
>>  >
>>  > 23.06.10, 13:48, "Monica Tepelus" :
>>  >
>>  >   
>>  >> Hi,
>>  >>  
>>  >>  It might be that the wave module doesn't answer the call before playing .
>>  >>  
>>  >>  Try using |exec instead of | in the route. I did this (with early media) 
>>  >>  and routed to a normal phone and it was ok.
>>  >>  
>>  >>  ${module}^h323$=fork earlymedia sip/sip:${called}@1... |exec wave/play//usr/local/share/yate/sounds/unavail.alaw;stoperror=busy;maxcall=20000
>>  >>  
>>  >>  If it still doesn't work make a small script that answers the call and 
>>  >>  then plays the file and route to it: external/nodata/script.php instead 
>>  >>  of wave/play....
>>  >>  
>>  >>  Monica Tepelus
>>  >>  
>>  >>  aucyxob wrote:
>>  >>  > need help!
>>  >>  >
>>  >>  > Please, explain to me how to make follow things:
>>  >>  >
>>  >>  > On incoming call i want add own early media (tone/ring)
>>  >>  > if desired target should not answer or failed I need to play a message.
>>  >>  >
>>  >>  >
>>  >>  > here is peice of my regexroute.conf:
>>  >>  > ${module}^h323$=fork earlymedia sip/sip:${called}@1... | wave/play//usr/local/share/yate/sounds/unavail.alaw;stoperror=busy;maxcall=20000
>>  >>  > [call.execute]
>>  >>  > ${callto}^earlymedia$=return;callto=tone/ring;fork.calltype=persistent;fork.autoring=true;fork.automessage=call.progress
>>  >>  >
>>  >>  > When I call in it, I hear earlymedia (tone/ring) and if it is fail I see that target is changed to wave/play but I hear tone/ring yet.
>>  >>  > ----------
>>  >>  > Anthony
>>  >>  >   
>>  >>  
>>  >>  
>>  >>     
>>  
>>  
>>  
>>