;Sound not playing Asterisk on "Playback" execute

General discussions about Asterisk.

Moderators: Moderator, Support

;Sound not playing Asterisk on "Playback" execute

Postby manas539 » Sun Jul 19, 2015 2:56 am

Hi all,

I am using the Asterisk-JAVA library to call an extension from the JAVA code to Asterisk server running on a Virtual Machine on the same system. Its an ASTERISK-NOW 5211 server. Both the operating systems are on the same network.
Below is the code used:
Code: Select all
import java.io.IOException;

import org.asteriskjava.*;
import org.asteriskjava.live.AsteriskChannel;
import org.asteriskjava.live.internal.AsteriskServerImpl;
import org.asteriskjava.manager.*;
import org.asteriskjava.manager.action.OriginateAction;
import org.asteriskjava.manager.response.ManagerResponse;
import org.asteriskjava.manager.AuthenticationFailedException;
import org.asteriskjava.manager.ManagerConnection;
import org.asteriskjava.manager.ManagerConnectionFactory;
import org.asteriskjava.manager.TimeoutException;

public class TryConnect  {
    private ManagerConnection managerConnection;

    public TryConnect() throws IOException
       ManagerConnectionFactory factory = new ManagerConnectionFactory("", "admin", "voiproot");
       this.managerConnection = factory.createManagerConnection();

    public void run() throws IOException, AuthenticationFailedException,TimeoutException
       OriginateAction originateAction;
        ManagerResponse originateResponse;

        originateAction = new OriginateAction();
        originateAction.setPriority(new Integer(1));
        originateAction.setTimeout(new Integer(5000));

        // connect to Asterisk and log in

        // send the originate action and wait for a maximum of 30 seconds for Asterisk
        // to send a reply
        originateResponse = managerConnection.sendAction(originateAction, 5000);

        // print out whether the originate succeeded or not

        // and finally log off and disconnect

    public static void main(String[] args) throws Exception
       TryConnect helloManager;

        helloManager = new TryConnect();

In the Asterisk CLI the output is like this:
Code: Select all
== Manager 'admin' logged on from
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Executing [10001@trial:1] Answer("SIP/10001-00000011", "") in new stack
    -- Executing [10001@trial:1] Answer("SIP/", "") in new stack
    -- Executing [10001@trial:2] Playback("SIP/", "pls-try-call-later") in new stack
    -- Executing [10001@trial:2] Playback("SIP/10001-00000011", "pls-try-call-later") in new stack
    -- <SIP/10001-00000011> Playing 'pls-try-call-later.ulaw' (language 'en')
    -- <SIP/> Playing 'pls-try-call-later.ulaw' (language 'en')
  == Manager 'admin' logged off from
    -- Executing [10001@trial:3] Hangup("SIP/10001-00000011", "") in new stack
    -- Executing [10001@trial:3] Hangup("SIP/", "") in new stack
  == Spawn extension (trial, 10001, 3) exited non-zero on 'SIP/'
  == Spawn extension (trial, 10001, 3) exited non-zero on 'SIP/10001-00000011'

So i have two issues now:

1. The sound from the Asterisk server is not playing on the system.
2. I get two Playback outputs on the console.

Please help me with the problem.

Posts: 6
Joined: Fri Jul 17, 2015 7:02 am

Return to Asterisk General

Who is online

Users browsing this forum: No registered users and 1 guest