Howto send a SIP_MESSAGE outside a dialog?

Hi

I’m trying to send a SIP_MESSAGE outside a dialog (no INVITE)
and have problems when the 200-OK response comes.

The sent message seems ok and the other side accepts it and replys
with a SIP 200-OK. The problem is that asterisk dont seem to
recognize the Call-ID, which then leads to retransmissions.

MESSAGE sip:7890010@192.168.136.10 SIP/2.0
Via: SIP/2.0/UDP 192.168.136.10:5060;branch=z9hG4bK-4e117396
From: <sip:3@192.168.128.151>;tag=as6d64feff
To: "7890010" <sip:7890010@192.168.136.10>
Call-ID: 3c00ffa41a579baa337b85951d2da5e1@192.168.128.151
CSeq: 101 MESSAGE
Max-Forwards: 70
Content-Type: text/plain
Content-Length: 48

<alarmres><ref>3003</ref><snu>0</snu></alarmres>
---
<--- SIP read from 192.168.136.10:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.136.10:5060;branch=z9hG4bK-4e117396
To: "7890010" <sip:7890010@192.168.136.10>;tag=7a82b1c2
From: <sip:3@192.168.128.151>;tag=as6d64feff
Call-ID: 3c00ffa41a579baa337b85951d2da5e1@192.168.128.151
CSeq: 101 MESSAGE
User-Agent: Microbit SIP-stack
Content-Length: 0


<------------->
--- (8 headers 0 lines) ---
[Apr  4 16:09:47] DEBUG[21197]: chan_sip.c:5458 find_call: That's odd...  Got a response on a call we dont know about. Callid 3c00ffa41a579baa337b85951d2da5e1@192.168.128.151
[Apr  4 16:09:47] DEBUG[21197]: chan_sip.c:16933 sipsock_read: Invalid SIP message - rejected , no callid, len 312                                                                                              

The code for sending is this

struct sip_request req ;
const char* host ;
char buf[100];
char tmp[100];

memset(&req,0,sizeof(req)) ;

// get from and to from previous call
init_req( &req, SIP_MESSAGE, get_in_brackets( (char*)get_header( pReq, "From") ) ) ;
copy_header( &req, pReq, "Via" ) ;

//  Add a tag to From field
strcpy( tmp, get_header( pReq, "To" ) ) ;
make_our_tag(buf, sizeof(buf) );
strcat( tmp, ";tag=" ) ;
strcat( tmp, buf ) ;
add_header( &req, "From", tmp ) ;

// ### BUG ###
// avoid a bug in asterisk,
// they leaves the last '>' when parsing
strcpy( tmp, get_header(pReq,"From") ) ;
if( tmp[strlen(tmp)-1] != '>' )
{
	strcat( tmp, ">" ) ;
}
add_header( &req, "To", tmp ) ;


host = S_OR(pSip->fromdomain, ast_inet_ntoa(pSip->ourip.sin_addr));
sprintf( tmp, "%s@%s", generate_random_string(buf, sizeof(buf)), host);
add_header( &req, "Call-ID", tmp ) ;


sprintf( tmp, "%d MESSAGE", INITIAL_CSEQ ) ;
add_header( &req, "CSeq", tmp ) ;
copy_header( &req, pReq, "Max-Forwards" ) ;

add_text( &req, pstrMessage  );

send_request(pSip, &req, XMIT_RELIABLE, 1);

Can anyone give a hint on how to make this
scenario work

Thank’s

Kindly
Roland