> which libss7 version are you looked into I am in fact looking in to your version checked out using the following: svn co https://observer.router.hu/repos_pub/libss7/trunk libss7 > I'm using mine and have tons > of incomming calls with SAM. I know that you have tons of INCOMMING calls with SAM but I am reporting a bug in sending SAMs NOT receiving SAMs :-) libss7 is currently not programmed to initiate OUTGOING calls with SAM, but I think the code should be correct any way. > regards, > Attila Thank you Attila! You're so kind to share your code and provide help! regards, Tian > > On Tue, 2009-10-20 at 20:32 +0800, Tian wrote: > > Hi guys, > > > > I am reading libss7 source code and I think I've found a bug in it, > > following is my description of the bug and my tentative fix to the bug, as I > > don't have a running Asterisk box, I hope you will kindly help me check it, > > thanks! > > > > According to ITU-T Recommendation Q.763, section 1.6 'Mandatory variable > > part': > > > > "A pointer is also included to indicate the beginning of the optional part. > > If the message type indicates that no optional part is allowed, then this > > pointer will not be present. If the message type indicates that an optional > > part is possible, but there is no optional part included in this particular > > message, then a pointer field containing all zeros will be used." > > > > Thus, ISUP messages that don't carry any optionals fall into two categories: > > 1) those include a 'Pointer to start of optional part' containing all zeros > > (e.g., SAM falls into this category) and 2) those don't include a 'Pointer > > to start of optional part'. > > > > libss7 can only correctly construct ISUP messages carrying zero optional > > parameters that fall into category 2) if messages that fall into category 1) > > are to be constructed, libss7 will fail. > > > > The bug shows up in the file isup.c (Libss7 trunk revison 272, lines > > 2425-2432), my fix to this bug specifically for SAM is as follows (you may > > adopt the fix by replacing everyting between the fisrt and the last two > > comment lines): > > > > /* Make sure we grab our opional parameters */ > > if (optparams || (messagetype == ISUP_SAM)) { > > if (optparams) > > opt_ptr = &mh->data[offset + varparams]; > > /* a SAM message doesn't have any optionals, > > * but the 'Pointer to start of optional part' is still present > > */ > > offset += varparams + 1; /* add one for the optionals */ > > len -= varparams + 1; > > } else { > > offset += varparams; > > len -= varparams; > > } > > > > /* Whew, some complicated math for all of these offsets and different > > sections */ > > > > > > > > _______________________________________________ > > --Bandwidth and Colocation Provided by http://www.api-digital.com-- > > > > asterisk-ss7 mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-ss7 _________________________________________________________________ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-ss7/attachments/20091021/1867f8ba/attachment.htm