Twilio origination and termination SIP URI's with Java

▼魔方 西西 提交于 2019-12-12 03:43:32

问题


What I'm actually looking for are the termination and origination SIP URI's for a given trunk.

The closest I found so far was:

getCredential

public Credential getCredential(String credentialSid)

Gets the credentials from the credential list

Returns:
    the credentials

https://twilio.github.io/twilio-java/com/twilio/sdk/resource/instance/sip/CredentialListInstance.html#getCredential-java.lang.String-

How do I get a credentialSid, and, what is a credentialSid?

SID is Security IDentifier?

see also: Twilio: cannot rename subdomain null for SIP termination


回答1:


You can find out about SIP Credentials via the API.

And an example to get one in Java:

// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.sip.Credential;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "None";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Credential credential = client.getAccount().getCredentialList("CL32a3c49700934481addd5ce1659f04d2").getCredential("SC32a3c49700934481addd5ce1659f04d2");
    System.out.println(credential.getUsername()); 
  }
}

Hope this helps!



来源:https://stackoverflow.com/questions/38590611/twilio-origination-and-termination-sip-uris-with-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!