Network Function Virtualization (NFV) technology has emerged as a promising solution to optimize the deployment of network elements in cloud computing environment, both in terms of user Quality of Service (QoS) and resource allocation. To deliver IP Multimedia Subsystem (IMS) advanced services across multiple access networks, a cloud-based model likely improves not only flexibility in network management but also in service invocation. This model is particularly suitable for the inter-network between the IMS and Web Real-Time Communication (WebRTC) domain, which is a natural combination to significantly expand potential end-points of multimedia sessions. However, optimally allocating resource for each component in the system to provide QoS is challenging, and has not been fully considered in prior work. In this paper, we investigate an NFV architecture to enable effective communication between IMS and WebRTC users supporting smart community services, and propose an optimization model to design and allocate resources for such system while ensuring desired QoS level. Experimental results show our algorithms effectively allocate required amounts of resources for virtual components according to real-time increase or decrease in user demand.