Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] java – JAIN SIP asterisk registration

Posted on November 14, 2022

Solution 1 :

That’s a very unusual way to create a request. My guess here is that you have “rnrn”, which creates an empty line which terminates parsing of the SIP message. But this way of creating the message is not good anyway, you should let the constructor do its job for proper whitespaces and formatting with the protocol details and validated URIs.

I suggest you look at this example https://github.com/usnistgov/jsip/blob/master/src/examples/simplecallsetup/Shootist.java#L318

Otherwise please post here the std output and debug logs.

Problem :

I have prepared request which is as follows:

REGISTER sip:xxx.xxx.xxx.xxx SIP/2.0
Call-ID: [email protected]
CSeq: 1 REGISTER
From: <sip:[email protected]>;tag=textclientv1.0
To: <sip:[email protected]>
Max-Forwards: 70
Via: SIP/2.0/TCP 192.168.174.1:5060
Contact: <sip:[email protected];transport=tcp>
Content-Length: 0

At

inviteTid = sipProvider.getNewClientTransaction(request);

I am getting null exception.

My code is as follows:

public void register() throws NullPointerException{

Object logger;
try {

cseq++;
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
ViaHeader viaHeader = this.headerFactory.createViaHeader(this.ip,
this.port, "tcp", null);
viaHeaders.add(viaHeader);
// The "Max-Forwards" header.
MaxForwardsHeader maxForwardsHeader = this.headerFactory
.createMaxForwardsHeader(70);
// The "Call-Id" header.
CallIdHeader callIdHeader = this.sipProvider.getNewCallId();
// The "CSeq" header.
@SuppressWarnings("deprecation")
CSeqHeader cSeqHeader = this.headerFactory.createCSeqHeader(cseq,
"REGISTER");

Address fromAddress = addressFactory.createAddress("sip:"
+ username1 + '@' + server);

FromHeader fromHeader = this.headerFactory.createFromHeader(
fromAddress, "textclientv1.0");//String.valueOf(this.tag)//Integer.toString(hashCode())
// The "To" header.
ToHeader toHeader = this.headerFactory.createToHeader(fromAddress,
null);

// this.contactHeader = this.headerFactory
// .createContactHeader(contactAddress);

request = this.messageFactory.createRequest("REGISTER sip:"
+ server + " SIP/2.0rnrn");
request.addHeader(callIdHeader);
request.addHeader(cSeqHeader);
request.addHeader(fromHeader);
request.addHeader(toHeader);
request.addHeader(maxForwardsHeader);
request.addHeader(viaHeader);
request.addHeader(contactHeader);
//Response response=this.messageFactory.createResponse(200, request);

if (resp != null) {
boolean retry = true;
AuthorizationHeader authHeader = Utils.makeAuthHeader(headerFactory, resp,
request, username1, password);
request.addHeader(authHeader);
}
System.out.println(""+ request);
inviteTid = sipProvider.getNewClientTransaction(request);
// send the request out.
inviteTid.sendRequest();
this.dialog = inviteTid.getDialog();
// Send the request statelessly through the SIP provider.
//                  this.sipProvider.sendRequest(request);

// Display the message in the text area.
//debug("Request sent:n" + request.toString() + "nn");
} catch (Exception e) {
// If an error occurred, display the error.
e.printStackTrace();
//debug("Request sent failed: " + e.getMessage() + "n");
}
}
READ  [ANSWERED] android - flutter bloc dispose while using get_it
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress