问题
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