Play sound with Manager

Hi, I’m a newbie with Asterisk.
I’m developing a Delphi application for interact with Asterisk.
I’ve made a component that work with the manager, It intercept all messages from it.
All ok, but I need to tell Manager to play a sound, and I don’t know how to.
I’ve made (under Asterisk) a macro to play sound, and works well, but I don’t know wich command to run on Manager to play a sound, or run a macro that play a sound or every other thing that can do this.

Thanks for the help

Claudio

See voip-info.org/tiki-index.php … terisk+agi, section “AGI commands”.

Marco Bruni

Sorry if it’s a stupid question, but
I’ve already take a look at agi commands,
but from asterisk manager I don’t know how to run command.

Example:
Action: command
Command: play…

I’ve try with Action: command >> command: … and a lot of way but nothing.

How can I run an AGI command from Manager?

Thanks

One thing that I forgot:
when I say Asterisk Manager, for me is the interface than I call with:
Telnet myserver myport

Thanks

First you need to authenticate with the * server, using the credential defined in /etc/asterisk/manager.conf, so let’s suppose you defined a user xxx with secret yyy, you connect to the * manager interface via telnet , wait for the * welcome message, then input this:

Action: login
Username: xxx
Secret: yyy

if you receive a successful response we can go on and try to stream a file, otherwise check manager.conf and retry.

Marco Bruni

Login already done.

I’m already working with manager.

I can login, and use all commands listed in: voip-info.org/wiki/view/Asterisk+manager+API

Seems you are confusing the two interfaces, AGI interface and manager interface are differents, with agi you can play a file directly, through the manager interface you can’t do a direct play, you have to Originate or Redirect a call to a dialplan extension and there you can play a file (or even launch an AGI script :smile: ).

Hope it helps.

Marco Bruni

Ok, now I understand.

So the agi interface is that one that I can launch directly from the server, running asterisk command, and that returns the CLI cursor?

If is this one, how can I run this interface from a remote application? I must open an SSH session?

Thanks for the help.

Claudio

I’m going to resolve, I wish…

Situation:
I have two phones: 701 and 700

I’ve add in sip_additional.conf a 702

I’ve modified extensions.conf:
Added a macro:
[macro-macrotest]
exten => s,1,Playback(/var/lib/asterisk/sounds/it/vm-opts, noanswer)

Modified my context

[from-internal]
;allow phones to use applications
include => app-userlogonoff
include => app-directory
include => app-dnd
include => app-callforward
include => app-callwaiting
include => app-messagecenter
include => app-calltrace
include => parkedcalls
include => from-internal-custom
;allow phones to dial other extensions
include => ext-fax
include => ext-zapbarge
include => ext-record
include => ext-test
;allow phones to access generated contexts
include => from-internal-additional
;ADDED THIS LINE
exten => 702,1,Macro(macrotest)

Now, if i open a call between 700 and 701 and from manager I type:
Action: Redirect
Channel: SIP/700-xxxx
ExtraChannel: SIP/701-xxxx
Exten: 702
Context: from-internal
Priority: 1

It happen this:
in the two phones I hear the sound but after hearing it, the
call hang up automatically.

What I’m doing wrong?

Thanks

You’re doing nothing wrong, you’ve only one priority in your macro so after the execution of Playback * just ends the call, this is the normal behaviour; try put other priorities after Playback(), they will get executed.
I think you need to understand better how the * dial plan works, I suggest you to read the free book you can download here: asteriskdocs.org/modules/tin … .php?id=11.

Marco Bruni.