code: static private void syncDial()
      {
          try
          {
              PBX pbx = PBXFactory.getActivePBX();
  
              // The trunk MUST match the section header (e.g. [default]) that
              // appears
              // in your /etc/asterisk/sip.d file (assuming you are using a SIP
              // trunk).
              // The trunk is used to select which SIP trunk to dial through.
              Trunk trunk = pbx.buildTrunk("default");
  
              // We are going to dial from extension 100
              EndPoint from = pbx.buildEndPoint(TechType.SIP, "100");
              // The caller ID to show on extension 100.
              CallerID fromCallerID = pbx.buildCallerID("100", "My Phone");
  
              // The caller ID to display on the called parties phone
              CallerID toCallerID = pbx.buildCallerID("83208100", "Asterisk Java is calling");
              // The party we are going to call.
              EndPoint to = pbx.buildEndPoint(TechType.SIP, trunk, "5551234");
  
              // Trunk is currently ignored so set to null
              // The call is dialed and only returns when the call comes up (it
              // doesn't wait for the remote end to answer).
              DialActivity dial = pbx.dial(from, fromCallerID, to, toCallerID);
  
              Call call = dial.getNewCall();
  
              Thread.sleep(20000);
  
              logger.warn("Hanging up");
              pbx.hangup(call);
          }
          catch (PBXException | InterruptedException e)
          {
              System.out.println(e);
          }
      }
docs: Simple synchronous dial. The dial method won't return until the dial
  starts. Using this method will lockup your UI until the dial starts. For
  better control use the async Dial method below.