SIP URI Call from outside

I have CommuniGate and Asterisk. - Asterisk; - CG;

Trying to call from CG to Asterisk (SIP URI (sip:200@ )

Call is OK. on SIP-agent i receive CallerID(name).
but when i try to recall, SIP URI is name@ instead of name@

I know this is not standard Asterisk usage, but i hope it’s possible.

Packet to Asterisk:

<— SIP read from —>
INVITE sip:200@;user=phone SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK1878;upaddr=;rport
P-CGP-Identity: sbabenkov@
Record-Route: sip:;lr
Record-Route: sip:rev.488.dialog.cgatepro;lr
Via: SIP/2.0/TCP;branch=z9hG4bK024fsnl23o1s3g2qnll5mgr;rport=54652
Max-Forwards: 69
From: sip:sbabenkov@;tag=bi5bqqnf6lhc745ds2i0
To: sip:200@;user=phone
Call-ID: 9VOZqEvooIdRqK2AV7T71k00O6kOLD
Contact: sip:sbabenkov@
CSeq: 851 INVITE
Expires: 120
Supported: 100rel,sec-agree
Privacy: none
Accept: application/sdp
User-Agent: E71-1 RM-346 210.21.006
P-Preferred-Identity: sip:sbabenkov@
Content-Type: application/sdp
Content-Length: 523

From Asterisk to Agent:

INVITE sip:200@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK5577a6f8;rport
From: “sbabenkov” sip:sbabenkov@;tag=as43c68036
To: sip:200@
Contact: sip:sbabenkov@
Call-ID: 3a4706042a3917bf2d43215870737a82@
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Tue, 21 Apr 2009 08:44:47 GMT
Supported: replaces
Content-Type: application/sdp
Content-Length: 363

I’ve tried to set CALLERID(num) like this:

exten => s,n,Set(CALLERID(num)=“sip:300@”)

After that i receive

From: "300@" sip:sip:300@;tag=as237db75d
Contact: sip:sip:300@

I just want Asterisk not to add it’s IP in the end.

Is it possible without source editing ?
If not, where and what should i change?

Sorry for my English… it’s not my native language.

Up. Anybody?

Problem solved with little cheating.

Ð’ from-sip-external:
exten => s,n,Set(TMP=${CUT(SIP_HEADER(From),<,2)})
exten => s,n,Set(TMP=${CUT(TMP,>,1)})
exten => s,n,Set(TMP=${IF(${TMP:0:4}=“sip:”?${TMP:4):${TMP})})
exten => s,n,Set(TMP1=${CUT(TMP,@,1)})
exten => s,n,Set(TMP2=${CUT(TMP,@,2)})
exten => s,n,Set(CALLERID(num)=${TMP1}%25${TMP2})

;Test if Redirect
exten => _.,10,GotoIf($[${REGEX("%" ${EXTEN})}]?20)
exten => _.,11,Goto(from-internal,${EXTEN},1)
exten => h,1,HangUp()

exten => _.,20,Set(TMP1=${CUT(EXTEN,%,1)})
exten => _.,21,Set(TMP2=${CUT(EXTEN,%,2)})
exten => _.,22,Macro(uridial,${TMP1}@${TMP2})
exten => _.,23,HangUp()