[asterisk-bugs] [Asterisk 0015552]: [patch] SIP_BODY function to get a body part of a SIP message

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jan 13 08:55:51 CST 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15552 
====================================================================== 
Reported By:                khw
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15552
Category:                   Functions/NewFeature
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     ready for review
Asterisk Version:           SVN 
JIRA:                       SWP-410 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 206090 
Request Review:              
====================================================================== 
Date Submitted:             2009-07-22 05:10 CDT
Last Modified:              2010-01-13 08:55 CST
====================================================================== 
Summary:                    [patch] SIP_BODY function to get a body part of a
SIP message
Description: 
this patch adds the function SIP_BODY for chan_sip to get a body part by
its Content-Type. Therefore, the existing find_sdp() is generalized to
find_content() and find_sdp() calls find_content() with the parameter
"application/sdp". 

usage example: ${SIP_BODY(application/pidf+xml)} to get a PIDF document
from the SIP body.
====================================================================== 

---------------------------------------------------------------------- 
 (0116580) lmadsen (administrator) - 2010-01-13 08:55
 https://issues.asterisk.org/view.php?id=15552#c116580 
---------------------------------------------------------------------- 
"In case more body parts with the same Content-Type are 
+			availabe, just the first is returned."

Can't we add some sort of iterator or utilize this in the same way that
DUNDIQUERY and DUNDIRESULT are implemented? This would give the ability to
access those multiple Content-Types as that is likely going to be the first
feature request once this is implemented and used :)

Here is an example of how I would imagine it being used in a loop to sort
through multiple Content-Type results (same way DUNDIQUERY and DUNDIRESULT
are used).

exten => start,n,Set(BODY_ID=${SIP_BODY_QUERY(application/pidf+xml)})
exten => start,n,GotoIf($[${ISNULL(${BODY_ID})}]?no_body_id,1)
exten => start,n,Set(X=1)
exten => start,n,Set(BODY_RESULT=${SIP_BODY_RESULT(${BODY_ID},${X})})
exten => start,n,While($[${EXISTS(${BODY_RESULT})}])
; do something here with data
exten => start,n,Set(X=$[${X} + 1])   ; increment counter

; get next result
exten => start,n,Set(BODY_RESULT=${SIP_BODY_RESULT(${BODY_ID},${X})})
exten => start,n,EndWhile()

; finished the loop, no more results

exten => no_body_id,1,NoOp(Content-Type not found) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-01-13 08:55 lmadsen        Note Added: 0116580                          
======================================================================




More information about the asterisk-bugs mailing list