Communication ended after 7 seconds

i have installed asterisk on a virtual machine (Centos) and i have two (x-lite) for simulation

i want the user1 make a call to the user2 and when the user2 answer the call he listens to an audio file(this part is ok)

but now i need the communication ended automatically after 7 seconds

how i can do it

my sip.conf

[general]

[user1]
host=dynamic
username=user1
type=peer
context=default

[user2]
host=dynamic
username=user2
type=peer
context=default

extensions.conf
1,dial(sip/user1,10,A(hello)
2,hangup()

This looks like a case for originate. There is an option on Dial to set an absolute time limit, but it feels more like you want to send a standard message with no through audio after it.

L(x) where x is the call limit in milliseconds

thx Euphorian but i was the same problem the audio file continue playing after 7 secondes

The timer will apply to the through call. One assumes you know the length of any audio you play before that.

the duration of my audio file is 4 minutes, i want stop it in 7 secondes but the communication still runing

Create a copy of the the first 7 seconds, offline, using something like sox.

If you want to do it the hard way, you will need to use a Local channel, so that you do have a through connected Dial that will timeout.

Note, as currently described, your application is more suited to originate, than to the use of the A option on Dial. Dial is about the through connection, but you seem not to be creating one.

thank you very much david55 and Euphorian :smiley: i have fixed my problem using sox and the option L

i have reduce the audio file to 6 secondes and i have added 1 seconde for the L option
so the communication ended in 7 secondes

exten=>2000,1,dial(SIP/2000,10,A(/var/lib/asterisk/urphonee)L(1000))

thank you very much guys