Exemplo n.º 1
0
  public void sendModifyConnection() {

    try {
      caProvider.addJainMgcpListener(this);

      CallIdentifier callID = caProvider.getUniqueCallIdentifier();

      EndpointIdentifier endpointID =
          new EndpointIdentifier("media/trunk/Announcement/enp-15", "127.0.0.1:" + mgStack);

      String identifier = ((CallIdentifier) caProvider.getUniqueCallIdentifier()).toString();
      ConnectionIdentifier connectionIdentifier = new ConnectionIdentifier(identifier);

      ModifyConnection modifyConnection =
          new ModifyConnection(this, callID, endpointID, connectionIdentifier);

      String sdpData =
          "v=0\r\n"
              + "o=4855 13760799956958020 13760799956958020"
              + " IN IP4  127.0.0.1\r\n"
              + "s=mysession session\r\n"
              + "p=+46 8 52018010\r\n"
              + "c=IN IP4  127.0.0.1\r\n"
              + "t=0 0\r\n"
              + "m=audio 6022 RTP/AVP 0 4 18\r\n"
              + "a=rtpmap:0 PCMU/8000\r\n"
              + "a=rtpmap:4 G723/8000\r\n"
              + "a=rtpmap:18 G729A/8000\r\n"
              + "a=ptime:20\r\n";

      modifyConnection.setRemoteConnectionDescriptor(new ConnectionDescriptor(sdpData));

      modifyConnection.setTransactionHandle(caProvider.getUniqueTransactionHandler());

      caProvider.sendMgcpEvents(new JainMgcpEvent[] {modifyConnection});

      logger.debug(
          " ModifyConnection command sent for TxId "
              + modifyConnection.getTransactionHandle()
              + " and CallId "
              + callID);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      ModifyConnectionTest.fail("Unexpected Exception");
    }
  }
Exemplo n.º 2
0
 public void processMgcpResponseEvent(JainMgcpResponseEvent jainmgcpresponseevent) {
   logger.debug("processMgcpResponseEvent = " + jainmgcpresponseevent);
   switch (jainmgcpresponseevent.getObjectIdentifier()) {
     case Constants.RESP_MODIFY_CONNECTION:
       if (jainmgcpresponseevent.getReturnCode().getValue()
               == ReturnCode.ENDPOINT_INSUFFICIENT_RESOURCES
           || jainmgcpresponseevent.getReturnCode().getValue()
               == ReturnCode.TRANSACTION_EXECUTED_NORMALLY) {
         responseReceived = true;
       }
       break;
     default:
       logger.warn("This RESPONSE is unexpected " + jainmgcpresponseevent);
       ModifyConnectionTest.fail("Incorrect response for MDCX command ");
       responseReceived = false;
       break;
   }
 }