Nik Kashi
Nik Kashi

Reputation: 4596

How to play sound for callee in asterisk

For dialing a number I am using

exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg,");

in my java application. And for playing sound for caller using this snippet:

exec("background", "custom/incorrectPassword");

But how can I play sound for call receiver after callee the phone up?

Upvotes: 0

Views: 3069

Answers (3)

Nik Kashi
Nik Kashi

Reputation: 4596

as mentioned in :voip-info it is possible with A option. Means that for this case using

exec("DIAL", "DAHDI/g0/" + callingPhoneNo + "," + currentTimeOut + ",mg|A(custom/greet)");

command, play greet file for callee after picking the phone up.

Upvotes: 0

arheops
arheops

Reputation: 15247

There are 3 options for doing this. Actually only one option needed, but historically we have 3

1) Exactly for this purpose, option A in Dial command diallout parameters

A(x): 
        x - The file to play to the called party
    Play an announcement to the called party, where <x> is the prompt
    to be played

2) Privacy mode options.

p: This option enables screening mode. This is basically Privacy mode without memory.

P([x]): Enable privacy mode. Use <x> as the family/key in the AstDB
    database if it is provided. The current extension is used if a database
    family/key is not specified.

Privacy play message based on callerid and ask name if not found

3) Macro and Gosub on answer. Just different and most flexible ways to do something with called, using that you can collect input/confirm/decline call etc.

M(macro[^arg[^...]]):

        macro - Name of the macro that should be executed.

        arg - Macro arguments

    Execute the specified <macro> for the *called* channel  before
    connecting to the calling channel. Arguments can be specified to the Macro
    using '^' as a delimiter. The macro can set the variable ${MACRO_RESULT}
    to specify the following actions after the macro is finished executing:

        ${MACRO_RESULT}: If set, this action will be taken after
        the macro finished executing.

            ABORT: Hangup both legs of the call

            CONGESTION: Behave as if line congestion was
            encountered

            BUSY: Behave as if a busy signal was encountered

            CONTINUE: Hangup the called party and allow the
            calling party to continue dialplan execution at the next priority

            GOTO:[[<context>^]<exten>^]<priority>: Transfer the
            call to the specified destination.




U(x[^arg[^...]]): 

    x - Name of the subroutine to execute via Gosub
    arg - Arguments for the Gosub routine

Execute via Gosub the routine <x> for the *called* channel before
connecting to the calling channel. Arguments can be specified to the Gosub
using '^' as a delimiter. The Gosub routine can set the variable ${GO
SUB_RESULT} to specify the following actions after the Gosub returns.

    ${GOSUB_RESULT}: 
        ABORT: Hangup both legs of the call.
        CONGESTION: Behave as if line congestion was
        encountered.
        BUSY: Behave as if a busy signal was encountered.
        CONTINUE: Hangup the called party and allow the
        calling party to continue dialplan execution at the next priority.
        GOTO:[[<context>^]<exten>^]<priority>: Transfer the
        call to the specified destination.

Upvotes: 2

Vikas
Vikas

Reputation: 43

Also you can use special extension(Macros) in Dial application. This is run after callee pick up phone. In which you can pass parameters too.

Example 2: Dial macro http://www.voip-info.org/wiki/view/Asterisk+cmd+Dial

Upvotes: 0

Related Questions