Hello,

the INVITE comes with that Caller ID set from Asterisk. It was very unlikely Kamailio changes it unless you use uac module.

I guess Asterisk in matching on source IP and port and happens to select another (pretty much randomly) caller id.

Try to use type=user in sipusers table.

Another option is to get the caller id from incoming invite to asterisk and set it for outgoing invite from asterisk.

Let me know if any of these works.

Cheers,
Daniel


On 10/12/10 5:14 PM, Lucas Alvarez wrote:
Hi Daniel-Constantin, thank for your quick response. This is the link to the SIP trace: 

http://www.euscorp.com/images/Wedpooi321989812j1DD9ddd9PaHw8XCa

I didn't send it through the list cause the body size needed approval.
The trace is a call from the extension 1090 to 1020. Kamailio is listening at 192.168.15.11:5060 and asterisk at 192.168.15.11:5080. Additionally I have pasted below a short CLI trace on asterisk showing up a NoOp with the caller id followed by the dial and the first invite. 
I really appreciate you help. Regards.

Lucas


CLI trace:


    -- Executing [1020@longdistance:1] NoOp("SIP/1090-00000037", "Callerid number: 1090      Name: Lucas Voice ") in new stack
    -- Executing [1020@longdistance:2] Dial("SIP/1090-00000037", "SIP/1020") in new stack
[Oct 12 10:44:26] DEBUG[17631]: chan_sip.c:3462 update_call_counter: Call to peer '1020' is 1 out of 10
Audio is at 192.168.15.11 port 18106
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding codec 0x2 (gsm) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.15.11:5060:
Via: SIP/2.0/UDP 192.168.15.11:5080;branch=z9hG4bK7c1bd27b;rport
From: "Lucas Voice" <sip:1020@192.168.15.11>;tag=as1a1d0e0e
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Tue, 12 Oct 2010 14:44:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Content-Type: application/sdp
Content-Length: 287






On Mon, Oct 11, 2010 at 7:36 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
 Hello,


On 10/11/10 11:28 PM, Lucas Alvarez wrote:
Hi, I'm having a problem with the caller ID, I have implemented an
integration between asterisk and kamailio following this tutorial:
http://kb.asipto.com/asterisk:realtime:kamailio-3.0.x-asterisk-1.6.2-astdb
and the problem is that when I call from extension, let's say 1000, to
another extension, let's say 2000, the callerid number is always the
number I'm calling, in this case 2000. Using xlog and printing $fu,
$fU variables I realize that when the call came from asterisk to the
destination number,  kamailio changes the "From" headers. I will
appreciate any kind of help.
Regards.

can you take a SIP trace of such case on kamailio server? preferably with ngrep:

ngrep -d any -qt -W byline port 5060

Cheers,
Daniel

--
Daniel-Constantin Mierla
http://www.asipto.com



-- 
Daniel-Constantin Mierla
http://www.asipto.com