;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("192.168.220.10", "admin", "voiproot");
       this.managerConnection = factory.createManagerConnection();
              
    }

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

        originateAction = new OriginateAction();
        originateAction.setContext("trial");
        originateAction.setChannel("SIP/10001@192.168.220.10");
       
       
        originateAction.setExten("10001");
        originateAction.setCallerId("10001");
       
       
        originateAction.setPriority(new Integer(1));
        originateAction.setTimeout(new Integer(5000));
       

        // connect to Asterisk and log in
          managerConnection.login();
       

        // 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
        System.out.println(originateResponse.getResponse());

        // and finally log off and disconnect
        managerConnection.logoff();
    }

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

        helloManager = new TryConnect();
        helloManager.run();
    }
}



In the Asterisk CLI the output is like this:
Code: Select all
== Manager 'admin' logged on from 192.168.220.20
  == 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/192.168.220.10-00000010", "") in new stack
    -- Executing [10001@trial:2] Playback("SIP/192.168.220.10-00000010", "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/192.168.220.10-00000010> Playing 'pls-try-call-later.ulaw' (language 'en')
  == Manager 'admin' logged off from 192.168.220.20
    -- Executing [10001@trial:3] Hangup("SIP/10001-00000011", "") in new stack
    -- Executing [10001@trial:3] Hangup("SIP/192.168.220.10-00000010", "") in new stack
  == Spawn extension (trial, 10001, 3) exited non-zero on 'SIP/192.168.220.10-00000010'
  == 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.

Thanks.
manas539
Newsterisk
 
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