I'm trying to understand how forwarding should work in an IMS deploy. Forwarding is performed by an AS in the middle of the SIP path, for example when the original called subscriber doesn't answer the call. In that case, the AS cancels the call (sends a CANCEL), and sends a new INVITE to the forwarded user. Before sending the CANCEL, however, the original called party has already issued his SDP answer in a reliable manner (183 with 100rel).
In the new INVITE, the SDP offer from the original calling party is used, and the forwarded user sends his own SDP answer, that obviously, differs from the original called party. the AS, when receiving this answer, and since it already sent the answer from the original called party, instead of just relaying this new answer, sends an UPDATE to the calling party, with the new answer. The UPDATE is accepted by the calling party and later on the call is established.
What concerns me is that according to RFC 3264, section 8 "Modifying the Session":
When issuing an offer that modifies the session,
the "o=" line of the new SDP MUST be identical to that in the
previous SDP, except that the version in the origin field MUST
increment by one from the previous SDP.
In this case, looking at the trace, the SDP issued in the UPDATE is completely different, including the o= line, as it comes from a different agent. Should the AS manipuate the SDP of the new SDP answer to hide the fact that it comes from another UA? Is there another more standard way for this flow?
Thanks for your insight.
What concerns me is that according to RFC 3264, section 8 "Modifying
the Session":
When issuing an offer that modifies the session, the "o=" line of the
new SDP MUST be identical to that in the previous SDP, except that the
version in the origin field MUST increment by one from the previous
SDP.
Provided this is the same SIP endpoint or B2BUA. see below the rational.
In this case, looking at the trace, the SDP issued in the UPDATE is
completely different, including the o= line, as it comes from a
different agent. Should the AS manipuate the SDP of the new SDP answer
to hide the fact that it comes from another UA? Is there another more
standard way for this flow?
UPDATE method can serve several purpose :
Change the signaling information (let's say SIP headers)
Change the media information (let's say SDP fields)
Update both at the same time.
You are in the third case, the SIP endpoint has changed so the SDP must be different.
From the AS point of view, 99% of the time the AS must be transparent to those changes and act as a pure SIP proxy BUT there are some specific cases where it may act as a B2BUA and hide that from the caller using RTP proxy.
Related
I am new to sip protocol.I understand the normal sip mechanism like how it works.I know about sip re-invite method which is useful to update the SDP(Session Description Protocol) parameters.But recently i found UPDATE sip method which also do the same thing.my questions are
1) Why we need UPDATE sip method?
2) Which phones(like zoiper,sjphone) are sending this UPDATE request to the servers for SDP parameter changes?
Any help would be great.
Thank you
Your answer can be found in the abstract of RFC331 - The SIP UPDATE method:
UPDATE allows a client to update parameters of a session (such as the set of media streams and their codecs) but has no impact on the state of a dialog. In that sense, it is like a re-INVITE, but unlike re-INVITE, it can be sent before the initial INVITE has been completed. This makes it very useful for updating session parameters within early dialogs.
To learn which phones can utilize UPDATE you'd best read the manuals.
I'm not super familiar with VOIP.. I've been doing some research but have had a difficult time finding an answer to this question.
What I need to do, is check to make sure a phone is being forwarded to a specific number. I'm trying to determine if there is a way to do this by placing a call to it. Looking at rfc 3261, it seems the VIA header would contain the info I need if a forwarding phone just acts as a proxy, but it seems this is unlikely to work, judging from the line:
Each proxy uses the Via header field to
determine where to send the response and removes its own address from
the top.
Is it possible to tell if a call was forwarded to a specific number, simply by placing a call to it and monitoring the headers? If so, could I simply download a VOIP app, and snoop the packets with WireShark? Or will I need to create my own VOIP client?
You can use the SIP history-info header, see rfc4244 for details.
I'm writing simple SIP-proxy application which stands between Astreisk and SIP client (any softphone). The purpose of the application is to calculate the duration of the call.
Below is example of regular flow:
Client sends INVITE to SIP-Proxy, SIP-Proxy resends INVITE to Asterisk
Asterisk answers with 200 OK, SIP-Proxy resends 200 OK to client.
Client answers with ACK, SIP-Proxy resends ACK to Asterisk
Whenever one of the parties sends BYE, conversation should be finished.
On step 2 I assumes that call is started (e.g. rtp media flow is started). Then I wait for BYE message to calculate duration of the call. However I noticed that some clients never goes to step 3 and 4. No call end notification received from any parties after step 2. And duration of such call is infinitely.
What is the best way to find out start/stop time of the SIP call without sniffing RTP flow ? Should I wait for step 3 to mark the start of the call ? What if client omit ACK or what if UDP datagram with ACK is missed in the network ?
For now I used to think there is no reliable way to figure out that SIP call is started. Maybe I should use Astrisk channels API instead to track active calls.
Another option is to generate a RE-INVITE to test the existence of the Session. Dont have to negotiate a timer or anything. Just using re-invite could help. Reuse the SDP to ensure that no media changes happen. But then your application is moving out of being a Proxy in the path of the call to being a application server.
Also the duration can only be capped to nearest interval for this re-invite request and not necessarily the exact time the call was released.
Your problem seems to be at SIP level, because your proxy does not add itself into the message path using a Route header. This process is called Record Routing. If doing so, all subsequent requests in your dialog will also traverse it (ACKs and BYEs included).
You should not reinvent the wheel by writing a SIP proxy. For example, you could use a open-source, flexible, powerful and completely customizable SIP Proxy in order to build any possible scenario you could think of: OpenSIPS!
Consider a queue of items on server. The client then reads 10 queued items at a time using a REST web service. Naturally, when the client has consumed these items the server should remove them server-side.
Q: What is the best approach if we consider both robustness, network load and restfulness?
I can think of three possible solutions:
The client asks for new items. The server then...
sends item 1..10 (GET) and removes them immediately. Hopefully the items arrived at the client.
sends item 1..10 (GET), client sends ACK for 1..10 (DELETE), and the server removes the items.
sends item 1..10 (GET). Next time the client asks for 11..20 (GET), the previous items are removed on the server.
I believe both #1 and #3 violate the restful principle. E.g. Only the DELETE method may delete objects. However, they both avoid the data traffic for the ACK command.
Not sure what's best here. Perhaps there is an even better solution?
Here's the answer in votable format. I hope it helps clarify your options a bit more.
It's important in a REST-style architecture that the implementation of an API not change the implementation of any underlying protocols -- in this case it means that GET requests should be idempotent. While idempotent does not mean that the underlying resources can't change, or go away forever (AKA be deleted), having that happen as a direct or indirect result of a GET seems to not be in accordance with the spirit of the protocol.
Any system that guarantees delivery of a message requires some kind of handshake to single that the intended receiver successfully received the message -- if HTTP is the protocol in question, then that implies two requests. Even in the case where the behavior of GET were modified to lazily delete the resources, the handshake is still present -- it has just been shifted in time. Again, if HTTP is the protocol in questions, then using the existing methods of GET and then DELETE for the retrieval and deletion for that handshake seems best. The result shouldn't tax the network any more than any equivalent approach.
A requirement for the SIP PBX I created for my company was to record all calls passing through it. I solved it by forcing all SIP message to pass through the PBX and to modify the SDP body so the stream passes through it and gets recorded. It works well.
I recently found out that this is not allowed.
Is there any other way to implement call recording and how "wrong" is this in regard to the protocol?
It sounds like you're describing a SIP proxy, more or less a Session Border Controller (SBC). A proxy can modify SDP, though it should be careful in doing so. Typically SBCs will set the media destination to themselves, and proxy the data to the destination. So this is perfectly legal spec-wise (assuming the devices are already coming to your server).
However, "Not allowed" could also mean "recording calls is legally not allowed", which varies a lot state-to-state.
A more conventional way to implement call recording would be to capture the RTP packets on the wire and put them together to create an audio file. There are quite a few tools around to do exactly that and it's even inbuilt into Wireshark.
As far as tweaking with the SDP goes it's definitely not something that is "not allowed" at least not on a technical level. A lot of SIP Proxy's are forced to mangle the IP addresses in SDP when user agents put private IP addresses in them. You'll find most SIP servers out there have some sort of capability in this regard and it's often call NAT mangling or similar.